Processing data from multiple files
显示 更早的评论
Hello
i have written a code for a standalone app in the app desginer that supposed to read number of excel files and process the data from them
this part of the code is responsible to read the data and assign it to variables.
[app.filenamelsr,pathname] = uigetfile({'*.xls';'*.xlsx'},MultiSelect="on");
app.C=iscell(app.filenamelsr(1,2));
if app.C==1
app.Lengthlsr=length(app.filenamelsr);
else
app.Lengthlsr=1;
end
for i=1:length(app.filenamelsr)
LSR(i)=xlsread(fullfile(pathname,app.filenamelsr{1,i}));
app.t_lsr(i)=LSR(i,:,1);
app.S(i)=LSR(i,:,2);
app.r(i)=LSR(i,:,3);
app.dt(i)=LSR(i,:,4);
app.t_k(i)=app.t_lsr(i)+273;
app.R_r(i)=app.r(i).*(10^(5));
end
but when i try to run it i get this error

app.filenamelsr are cells containing the file names. for example

my logic is that in order to use the first name the indices should be {1,1} and for the second {1,2} so forth. therefore for the loop it should be like that {1,i}
what did i do wrong? assume at least 2 files are loaded
thanks for the help
采纳的回答
更多回答(1 个)
Ergin Sezgin
2023-4-5
0 个投票
Hi Dolev,
Try using curly brackets "{}" instead of parentheses. Alternatively, take a look at datastore which is another option for importing and managing data collections.
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!