Displaying (in the prompt) latin characters, such as á, é, í, ó, ú, and ñ, using MATLAB R2010b/R2011a for mac

조회 수: 20 (최근 30일)
Hi MATLAB community.
How can we display (in the prompt) latin characters, such as á, é, í, ó, ú, and ñ, using MATLAB R2010b/R2011a for mac (last iteration of Snow Leopard, 10.6.7)?
For example, when trying to run this script on MATLAB for mac
fprintf('Química, Matemáticas, Español.\n')
the prompt throws me
Qu?mica, Matem?ticas, Espa?ol.
which does not contain any of the latin characters I entered on my script, but those question marks as a replacement.
Any help will be greatly appreciated. Thank you.
P.S. 1: I am using an Apple Western Spanish keyboard to enter those latin characters.
P.S. 2: By prompt I am referring to the MATLAB Command Window.
  댓글 수: 4
Walter Roberson
Walter Roberson 2016년 9월 4일
Unfortunately I am not able to test this in Snow Leopard itself. I have virtual machine software that I tried with, but I hit the limitation that Apple's EULA did not permit Snow Leopard itself to be installed as a virtual machine (it did permit Snow Leopard Server to be installed in a virtual machine.) I think we got rid of the last of our Snow Leopard compatible machines here.
The earliest OS-X I could potentially test with is Lion, the release after Snow Leopard... but if I still have Lion install disks around then then are in some closet or other. Mavericks is the earliest I could definitely try with.
Ricardo Prada
Ricardo Prada 2017년 3월 2일
Thanks Fernando and Walter for your reply.
It looks like the bug was fixed some time ago. I am running MATLAB R2016b, and now those characters display correctly on the Command Window.

댓글을 달려면 로그인하십시오.

채택된 답변

Andrew Newell
Andrew Newell 2011년 4월 28일

Maybe I have been missing the embarrassingly obvious:

disp('Química, Matemáticas, Español.')
  댓글 수: 5
Walter Roberson
Walter Roberson 2011년 4월 28일
I wonder if perhaps it was stuck on a particular output font...
Ricardo Prada
Ricardo Prada 2011년 4월 28일
Hi Walter, at this point, I think it is tough to know. But most likely you are right.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Andrew Newell
Andrew Newell 2011년 4월 26일
You could try changing the locale.
EDIT: I found a better solution:
fprintf(native2unicode('Química, Matemáticas, Español.','latin1'))
The output is:
Química, Matemáticas, Español.>>
I looked at this command earlier but didn't use it in the right way. You said you wanted a prompt, so I took out the \n.
  댓글 수: 20
Walter Roberson
Walter Roberson 2016년 9월 4일
Note: when you see a 26 in the output of unicode2native, that indicates a character which could not be translated to the target character set.

댓글을 달려면 로그인하십시오.


Anandakumar Selvaraj
Anandakumar Selvaraj 2014년 2월 27일
Try this in your code
feature('DefaultCharacterSet', 'UTF8') %# for all Character support
or try 'Windows-1250' insted UTF8
'Windows-1250' for Central European languages that use Latin script, (Polish, Czech, Slovak, Hungarian, Slovene, Serbian, Croatian, Romanian and Albanian)
Note:- that UTF-8 can be used for all languages and is the recommended charset on the Internet.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by