How to read multiple files from matlab workspace?
2 次查看(过去 30 天)
显示 更早的评论
I have multiple files (sub1, sub2, sub3......subn) in matlab workspace and wants to apply a loop to extract the features. There is error in the code. Kindly guide me to fix this issue. My code is as follow:
s=43;
theta=[ ];
% numsubjects = length(sub);
for sub_i=1:s
subject = sub(str(sub_i));
theta1=mean(subject(3:7,26,:));
theta=[theta,theta1];
end
回答(1 个)
Walter Roberson
2021-7-21
Don't do that. Do not allow them to be created into different variables in the first place, and then you will not have to hack to dynamically create variable names.
2 个评论
Rik
2021-7-21
Then you need to change how you get them in your workspace. You're forcing yourself to write terrible code. Why would you do that for no good reason?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!