我发现了问题。我错过了在 fopen 命令中设置编码。工作解决方案:
%creating testfile
ascii=char([191 210 191 212 191 228 192 215 192 144 198 175 155 236 254 201 10]); %problem value here the 155
logID=fopen('testdatei.log','w','n','ISO-8859-1');
fwrite(logID,ascii);
fclose(logID);
% wrong filehandling
logID=fopen('testdatei.log');
line=fgetl(logID);
decode=double(line);
disp('wrong encoding')
decode(13)
fclose(logID);
%right filehandling
logID=fopen('testdatei.log','r','n','ISO-8859-1');
line=fgetl(logID);
decode=double(line);
disp('right encoding')
decode(13)
fclose(logID);