How to read greek characters in a .txt file

What is the command in order to read greek characters in a .txt file via matlab programming?
My file has 3 columns. The first one has names , the 2nd and 3rd have numbers.

Antworten (1)

Rik
Rik am 10 Dez. 2020

0 Stimmen

You can get my readfile function from the FEX. If you are using R2017a or later, you can also get it through the AddOn-manager.

10 Kommentare

Ivan Mich
Ivan Mich am 13 Dez. 2020
Οκ Ι am using your command,
t=readfile('test.csv','Delimiter',',')
and I have 10000x1 cell. Ι would like to separate into multiple columns but I can not make it, even if I use ,'Delimiter',',')
Could you help me?
Walter Roberson
Walter Roberson am 13 Dez. 2020
Can you attach the first couple of lines of your .txt file? Including enough to have some greek characters in the example.
I asked to "attach" rather than "post" in case there are special characters that might not be obvious from reading it on screen. For example, tabs.
Walter Roberson
Walter Roberson am 13 Dez. 2020
Also please indicate which MATLAB release you are using, as there was a relatively recent change that makes a difference.
Ivan Mich
Ivan Mich am 13 Dez. 2020
Bearbeitet: Ivan Mich am 13 Dez. 2020
I attach it. I am using 2019a matlab
Rik
Rik am 13 Dez. 2020
I'm currently not at a computer, so I can't run code on your file, but the input option 'Delimiter' does not exist for my function. That is why it isn't in the documentation.
That file is not three columns, it is 28 columns.
T = readtable('test.csv')
handles the sample with no problem
Ivan Mich
Ivan Mich am 16 Dez. 2020
Readtable command does not recognise greek characters. that 's why I used readfile command. My problem also exists. I can not separate each column from each other.
As I attached my file is there a way to make it?
Could you help me?
Your file does not contain any Greek characters. It is an ANSI-encoded file that does contain some special characters (like Ð), but no Greek symbols.
You can use readfile, but if you want to separate the lines along delimiters as well, you will have to parse each line separately (e.g. with the split function).
t=readfile('test.csv');
t=split(t,',');
Ivan Mich
Ivan Mich am 16 Dez. 2020
I am sorry command window shows me:
Error using split (line 99)
Element 2 of the text contains 20 delimiters while the previous elements have 19. All elements must
contain the same number of delimiters.
Error in Untitled (line 10)
t=split(t,',');
Walter Roberson
Walter Roberson am 16 Dez. 2020
Is it possible that you tried the split() twice ? It should not be able to give that error when the input is a character vector such as the result from readfile(), but it could give that error if the input is the result of a previous split()

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Labels and Annotations finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 10 Dez. 2020

Kommentiert:

am 16 Dez. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by