Matlab for Linux - language computations
Show older comments
I am trying to textscan .txt files in French into MATLAB (to do language computations) and I noticed that if I do this on my windows machine, where the default MATLAB character encoding is set as 'windows-1252', this works just fine. All special characters in the language are encoded correctly and then always recognized. However, if I try to do this on a Linux machine, the special characters are not recognized, and are replaced either by an empty square or the character '?'. I need this to be operational on a Linux machine, and have no idea how to make this happen.
What I have tried: opening a new session of MATLAB and typing in: slCharacterEncoding( 'Windows-1252') . With this change the special characters are not recognized. I also tried specifying the encoding as 'UTF-8' but this also did not work. Maybe this is the right approach but I did not do it correctly, I really don't know.
I was wondering if anyone has encountered something like this or has suggestions of what I can try or anyone I can talk to that would have suggestions?
Answers (1)
Walter Roberson
on 4 Mar 2016
fid = fopen('YourFile.txt', 'rt', 'n', 'Windows-1252');
datacell = textscan(fid, ..... );
fclose(fid);
Categories
Find more on Whos in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!