In Matlab read a specific column of data in a text file -


i have text file that, when opened in excel, contains columns of data.

i want use textread in matlab read specific column of data.

so, if excel file, do:

data = 'my_data_file.xlsx';  column_c = xlsread(data,'c:c'); 

but how do text file?

thanks!

you need know format of file. if have file looks :

name,price,volume

sally,120,4.8

john,135,35.49324

you use following code :

[~,~,c]=textread('file.txt',%s,%f,%f);

you insert ~ suppress output of columns.


Comments