How to use for loop in this problem
1 次查看(过去 30 天)
显示 更早的评论
n=3;
b=eye(n);
b1=b(:,1)
b2=b(:,2)
b3=b(:,3)
2 个评论
Stephen23
2022-4-26
编辑:Stephen23
2022-4-26
"How to use for loop in this problem"
The main problem I can see is forcing pseudo-indices into variable names. Once beginners start trying to access those variable names dynamically then they force themselves into writing slow, complex, inefficient code trying to access their data:
Basically your bad data design will force you into writing bad code.
What do you think is the problem?
回答(1 个)
chrisw23
2022-4-28
Maybe this helps.
tbl = array2table(b);
tbl.b1
tbl.b2
tbl.b3
% see also tbl.Properties
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!