Hi,
I'm loading data from different files in a loop. I want to create a table for each individual data file.
datafiles=recursivedir('PATH','*.txt');for o = 1:length(datafiles) %extract date and time from filename
[versn, name, ext] = fileparts(datafiles{o}); filename=datafiles{o}; fileID = fopen(filename,'r'); dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'MultipleDelimsAsOne', true, 'TextType', 'string', 'ReturnOnError', false); fclose(fileID); T_'name' = table(dataArray{1:end-1}, 'VariableNames', {'Output','Date','Time'});% I want to create a new table for each loop with the name set from the fileparts.
% Clear temporary variables
clearvars filename delimiter formatSpec fileID dataArray ans;end
I want to create a table for each loop that has the name like T_test1 and from the fileparts name(1) = 'test1' How do I do this, so I get a table for each loop?
Best regards, Jesper
Best Answer