Perform an action with multiple variables
1 view (last 30 days)
Show older comments
Kylie Hansen
on 10 Jul 2017
Edited: Kylie Hansen
on 10 Jul 2017
Hi, all! I have a lot of variables (over 2000 and counting), and I need to perform the same action on all of them. As of now, each variable is a Cx5 matrix where C is a very large number. I simply want the second column in each matrix. I realize that you can access the second column through
A(:,2)
but I am not sure how to do this for multiple variables. Each variable is similarly named; in my specific scenario, I have named each blg_x where x is the identifying number for the variable and the only aspect that will change (e.g. blg_0001, blg_1970). I have played around with loops that try to change variable names in them, but nothing seems to work. I was thinking that perhaps MATLAB has some way to perform an action on variables starting with certain letters (in my case 'blg') that I am not aware of, or some way to step through variable names like in a for or while loop. Some help would be appreciated!
1 Comment
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Whos 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!