필터 지우기
필터 지우기

MATLAB *sometimes* prints non-ASCII characters in the command window

조회 수: 6 (최근 30일)
Daniel Dolan
Daniel Dolan 2021년 2월 16일
I have noticed a strange quirk where MATLAB sometimes prints non-ASCII characters in the command window. Specifically, the multiplication sign used to denote array size can be lower case "x" (ASCII code 120) or extended character 215. The latter looks very similar to the former in the command window and some text editors, but the extended character looks very different in LaTeX. I noticed this problem when copying part of the command window (or the diary function) to a LaTeX document: all arrays sizes in an object display are messed up, but direct display with the whos command works as expected. Here's a quick example.
classdef example
properties
Array = rand(100,1);
end
methods
function object=example()
Q=evalc('disp(object)');
fprintf('Object display: ');
scanResult(Q);
Q=evalc('disp(object.Array)');
fprintf('Array display : ');
scanResult(Q);
end
end
end
function scanResult(buffer)
value=double(buffer);
index=find(value > 127);
if isempty(index)
fprintf('no extended characters');
else
N=numel(index);
fprintf('%d extended characters ',N);
for n=1:N
k=index(n);
fprintf('[%d -> %c] ',value(k),buffer(k));
end
end
fprintf('\n');
end
For MATLAB 2019b and 2020a on a Mac, there is one extended character in the object display and none in the array display.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by