Arabic document
Mostrar comentarios más antiguos
Hello Everyone. Please, I want to know if you can read Arabic document in matlab. Arabic is install on my computer, and when I try to read the file it gives me: {'المملكة' 'المغربية'} is that you have an idea please??
Respuesta aceptada
Más respuestas (6)
Walter Roberson
el 28 de Abr. de 2011
If I am correct about the file having been double-encoded, then:
fid = fopen('arabe.txt','r');
inputtext = char(native2unicode(fread(fid)));
fclose(fid)
21 comentarios
najmaf najma
el 28 de Abr. de 2011
Walter Roberson
el 29 de Abr. de 2011
Then I need more of the file to go on. You can find my email address on my user profile by clicking on my name.
najmaf najma
el 30 de Abr. de 2011
Walter Roberson
el 30 de Abr. de 2011
Received. I'm looking at it now.
Walter Roberson
el 30 de Abr. de 2011
fid = fopen('arabe.txt','r');
inputtext = native2unicode(fread(fid,'*uint8'),'UTF-16') .';
fclose(fid);
The text can then be seen by looking at inputtext
Note: you must be using a font that supports Arabic, such as Ariel Regular
Note: if applicable, your terminal must be set to decode UTF-8 . For example my terminal was set to interpret ISO-LATIN-1 by default and the characters did not come out right.
With the system I am using at the moment, the terminal automatically detected that the characters were Arabic and wrote them right to left.
I do not have a Windows system with MATLAB to test this out on; I am using a Linux-64 Matlab displaying to MAC OS-X.
najmaf najma
el 1 de Mayo de 2011
Walter Roberson
el 1 de Mayo de 2011
I looked at the image you sent. I cannot tell from that image which font you have used.
najmaf najma
el 2 de Mayo de 2011
najmaf najma
el 3 de Mayo de 2011
Walter Roberson
el 3 de Mayo de 2011
Please send a copy of the file with the changed encoding.
I do not have MATLAB for Windows, so I am not able to check using the same setup you are using.
najmaf najma
el 3 de Mayo de 2011
Walter Roberson
el 3 de Mayo de 2011
The command you used, slCharacterEncoding, is for Simulink; without simulink, the technique is to exit MATLAB, change the encoding, and re-start MATLAB.
http://www.mathworks.com/support/solutions/en/data/1-4TKQUB/index.html?solution=1-4TKQUB
Which locale are you normally in?
najmaf najma
el 5 de Mayo de 2011
Walter Roberson
el 5 de Mayo de 2011
http://www.mathworks.com/help/techdoc/matlab_env/brj_w4w-2.html
najmaf najma
el 5 de Mayo de 2011
Walter Roberson
el 5 de Mayo de 2011
Please start a new Question for that topic.
Also, I think people would appreciate if you could post the solution you came up with for this one.
najmaf najma
el 6 de Mayo de 2011
Walter Roberson
el 6 de Mayo de 2011
Which variable did you end up having to change, and what did you change it from and what did you change it to?
najmaf najma
el 6 de Mayo de 2011
Walter Roberson
el 6 de Mayo de 2011
It appears that najmaf changed the Windows Regional Language settings.
najmaf najma
el 7 de Mayo de 2011
najmaf najma
el 28 de Abr. de 2011
najmaf najma
el 28 de Abr. de 2011
0 votos
najmaf najma
el 28 de Abr. de 2011
0 votos
1 comentario
Walter Roberson
el 28 de Abr. de 2011
I needed you to use
fid = fopen('arabe.txt','r');
dec2hex(0 + fread(fid, 32, '*uint8'));
fclose(fid);
You used 'rt' instead. I don't know if that makes a difference.
najmaf najma
el 28 de Abr. de 2011
0 votos
najmaf najma
el 28 de Abr. de 2011
0 votos
2 comentarios
Walter Roberson
el 28 de Abr. de 2011
Yes, and I need to see _what_ those hexadecimal values are.
Wait -- is the first character of the file 0x0627, 'alif ? If so, then the file appears to be a UTF-8 encoding of a UTF-16 byte stream. The file appears to have been encoded twice!
najmaf najma
el 28 de Abr. de 2011
Categorías
Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!