Batch import of data from .txt files - MATLAB -


i have multiple .txt files each containing same format.

i've been reading these matlab individually using:

fid1 = fopen('test_1.txt','r');  data = textscan(fid1, '%f %*f %f %f %f %*[^\r\n]','headerlines',4); 

and using cell2mat extract values there.

how can batch import .txt files , store them all?

so far detect relevant files important using:

files = dir('test_*.txt'); 

but not sure how batch import each .txt file in above manner using loop.

clear data = {}; files = dir('test_*.txt'); i=1:length(files)     fn = files(i).name;     fid1 = fopen(fn,'r');     data{1,i} = textscan(fid1, '%*f %*f %f %f %f %*[^\r\n]','headerlines',4); end 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -