I'm working with MATLAB and sometimes need to use French in graphic
output. Like the 'plot' and 'title' functions. If I record my file in
UTF-8 encoding (by SciTE ou EmEditor), MATLAB's editor won't display
correctly the accented characters, then the graphic titles are with
garbled text. If I edit directly with MATLAB's editor, it saves m-
files using system's default encoding, in my case, GB2312, and some
accented characters can't be displayed (ï, ô, etc).
Yet, using UTF-8 encoded m-file, even if the display in MATLAB editor
is garbled, I can copy all text and paste it into MATLAB's command
prompt, then the output is as expected. This implies that MATLAB
handles UTF-8 characters, but how can I get them work in Editor?
Hope I'm made myself clear and thanks for all your help in advance.
--
kmc
% Displays current ASCII encoding in use in Matlab
for i = 1:255
roy(i) = cellstr(num2str(i));
orin(1,i) = char(i);
end
hanna = reshape(roy,255,1);
benjamin = reshape(orin,255,1);
x = char(hanna);
y = char(benjamin);
spacer(1:50,1:3) = ' ';
for r = 1:32
y(r,1:3) = 'N/A';
end
for r = 127:160
y(r,1:3) = 'N/A';
end
disp(' Current Windows/MATLAB Extended ASCII Usage');
disp
('*******************************************************');
disp([x(1:50,:),spacer,y(1:50,:),...
spacer,x(51:100,:),spacer,y(51:100,:),...
spacer,x(101:150,:),spacer,y(101:150,:),...
spacer,x(151:200,:),spacer,y(151:200,:),...
spacer,x(201:250,:),spacer,y(201:250,:)]);
clear spacer
spacer(1:5,1:3) = ' ';
disp
('*******************************************************');
disp([x(251:255,:),spacer,y(251:255,:)]);
disp
('*******************************************************');
% end of code
If you can't get the characters you want from direct ascii
manipulation you could always try LaTex.
Scott