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

4 次查看(过去 30 天)
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.

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Import and Export 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by