How do I form a loop to perform calculations on series of variables in workspace?
Show older comments
Matlab novice here; I have a set of data sheets with numbers loaded into workspace named, data1, data2,...,data50.
I am hoping to extract certain columns of data for analysis from data1 to data50 in a loop e.g.
for j=1:50
A = data{j}(:,3);
B = myAnalysis(A)
The idea is to extract the 3rd column from dataj and then use it for calculations. Any help would be much appreciated!
1 Comment
Jan
on 2 Oct 2012
While "data1" looks like a bad programming practize, "data{1}" is most likely the best way to go.
Accepted Answer
More Answers (2)
Image Analyst
on 2 Oct 2012
0 votes
I assume datasheets mean "worksheets" in an Excel "workbook" - just trying to get the terminology accurate. If so, you definitely don't want to use xlsread() unless you don't mind waiting forever. How comfortable or confident are you with using, or learning, ActiveX programming? Because that's what you'll need to do this efficiently.
Lei Gao
on 2 Oct 2012
0 votes
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!