How do i convert my text file into a column array with the same format as it is in the text file ?

2 Ansichten (letzte 30 Tage)
I have a text file (attached with the question)i want to convert into an array (a column wise array) .I am not able to get the required result .
Whenever i am textscan or fscanf its converting the file into a huge line with characters ,hence not converting it into an array.I want to each line as a row in the array.
I will attach the code i wrote :
fid = fopen('TestLists.txt')
u = fscanf(fid,'%s');
Kindly find the Text file attached.

Akzeptierte Antwort

KSSV
KSSV am 16 Apr. 2019
fid = fopen('TestLists.txt','r') ;
S = textscan(fid,'%s','delimiter','\n') ;
fclose(fid) ;
S = S{1} ;
S{1} % first line
S{3} % third line....

Weitere Antworten (0)

Kategorien

Mehr zu Data Import and Export finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by