char(2713) and fprintf('\x2713\n') don't show a checkmark in the command window
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
According to https://en.wikipedia.org/wiki/Check_mark, the unicode for a checkmark is 2713. However, `char(2713)` doesn't show a checkmark in the command window. It shows a question mark with a box around it. If I copy and paste it into Vim or Word, it shows up as a capital `S` with a smudge in the upper circle.
I also tried `fprintf('\x2713\n')`, which also printed a question mark inside a box.
Is there anyway to get a checkmark? (I am using Matlab 2019a)
I eventually want the checkmark to show when I copy and paste it into Vim or Word. Funnily enough I can enter unicode 2713 into Vim and get a checkmark. In Insert mode, press ctrl+V followed by `u2713` without quotes.
P.S. I got the above ideas from https://www.mathworks.com/matlabcentral/answers/10874-show-symbol-in-command-window
P.P.S. I can't even copy and paste the checkmark from Vim to the MATLAB command window. It shows up as a question mark within a box. Same if I try to paste it within single quotes to create a char array.
0 Commenti
Risposta accettata
Stephen23
il 29 Mar 2022
Modificato: Stephen23
il 29 Mar 2022
"According to https://en.wikipedia.org/wiki/Check_mark, the unicode for a checkmark is 2713."
Sure, lets try it using both FPRINTF and CHAR:
fprintf('\x2713\n%s\n',char(10003))
"However, `char(2713)` doesn't show a checkmark in the command window."
Nor should it. Hexadecimal x2713 converts to decimal 10003, which is the correct value to use with CHAR.
The incorrect decimal value that you tried converts to... hexadecimal xA99, aka U+0A99, which is the Gujarati Letter Nga, and looks like this:
ઙ
So far everything seems to be working exactly as expected.
However you are very unlikely to get any meaningful characters if you keep mixing up decimal and hexadecimal.
8 Commenti
Rik
il 29 Mar 2022
You could try setting a different font for the command window. I doubt that would work, but it might. The unicode version supported in the command window is not documented as far as I could find.
Più risposte (1)
KSSV
il 29 Mar 2022
Modificato: KSSV
il 29 Mar 2022
How about using sprintf.
s = sprintf('\x2713')
3 Commenti
Rik
il 30 Mar 2022
This might have to do with the font settings, but even on the same OS you might get different results: on R2007b I get a placeholder box when I run this code, but on R2017b (same OS) I do get the checkmark.
Vedere anche
Categorie
Scopri di più su Characters and Strings in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!