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

2 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

KSSV
KSSV il 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....

Più risposte (0)

Categorie

Scopri di più su Data Import and Export in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by