Read Arabic Text from Excel and print it

1 Ansicht (letzte 30 Tage)
Rana
Rana am 17 Dez. 2011
Bearbeitet: Walter Roberson am 20 Sep. 2016
I read Arabic Text from Excel, I need to print it in text file I can see the value in debugging in variable editor but when I print it in file it printed as symbols
here is the code
[num,txt,raw] = xlsread(file_name,'All','B1:B10');
filO = fopen(fname, 'w');
for im=1:(size(txt,1))
x=cell2mat(txt(im));
fwrite(filO,x)
end
the output file contains the following
ےےے ےےےے ےےےےے ےےے ےےےےے ےےےےےےے ےےے ےےے ےےےےے ےےےےے ےےےےے ےےےےےے
where is the problem please?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 17 Dez. 2011
  2 Kommentare
Rana
Rana am 17 Dez. 2011
thank you very much for your response
I tried all solutions it didn't give correct value
the problem that the value stores in variable is Arabic as I viewed it by variable editor among debugging , but it not printed correctly in text file
Walter Roberson
Walter Roberson am 17 Dez. 2011
You probably need to open the text file with 'wt' and UTF-8 attributes, and probably need to fprintf() the characters rather than fwrite() them, so that they will be translated to UTF-8.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Michael Katz
Michael Katz am 17 Dez. 2011
It might be matter of encoding, that is fwrite might be using ASCII or windows-1252. Try making the file UTF-8
fid = fopen(fname,'w','n','UTF-8')
  1 Kommentar
Rana
Rana am 17 Dez. 2011
thank you very much for your response
I tried the solution it didn't give correct value
the problem that the value stores in variable is Arabic as I viewed it by variable editor among debugging , but it not printed correctly in text file

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by