Quickly access a group of arrays using a loop
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a set of arrays labeled as "A1", "A2", "A3"..."An" What I would like to do is write a loop that allows me to access each without having to type the array names out individually. For instance if I wanted to access the first entry of each array:
for i=1:n A "i" (1) end
I've been messing with num2str and eval but I can't seem to get something that works. Any pointers would be appreciated.
Cheers, David
0 个评论
采纳的回答
Fangjun Jiang
2011-10-13
Using num2str() and eval() should be able to do it. See this post for details. But it is highly recommended not to name variable as A1, A2, A3,... as you now see the problem.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 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!