Hi all,
I have a batch file need to input to workspace for analysis, and the file type is *.csv.
Following is the code that I used, and the output file only show thw last one "P"
I hope each input file cas save as P1, P2, P3,….
May I know how to modify it ? thank you.
%% Open file dir
[filename,filedir] = uigetfile('*.csv','Multiselect','on');path = fullfile(filedir,filename);path = path';file = struct('name',path); %% Cover struc to cell
c= struct2cell(file);opts = delimitedTextImportOptions("NumVariables", 9);% Specify range and delimiter
opts.DataLines = [3, Inf];opts.Delimiter = [" ", ","];% Specify column names and types
opts.VariableNames = ["V", "I1V", "I2V", "I3V", "I4V", "I5V", "I6V", "I7V", "I8V"];opts.VariableTypes = ["double", "double", "double", "double", "double", "double", "double", "double", "double"];opts.ExtraColumnsRule = "ignore";opts.EmptyLineRule = "read";%% Readtable Import the data
for i=1:length(file) P = table2array(readtable(c{i}, opts));end
Best Answer