How to use for loop in this problem

1 visualizzazione (ultimi 30 giorni)
하민 김
하민 김 il 26 Apr 2022
Risposto: chrisw23 il 28 Apr 2022
n=3;
b=eye(n);
b1=b(:,1)
b2=b(:,2)
b3=b(:,3)
  2 Commenti
Stephen23
Stephen23 il 26 Apr 2022
Modificato: Stephen23 il 26 Apr 2022
"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?
하민 김
하민 김 il 26 Apr 2022
thanks for your answer

Accedi per commentare.

Risposte (1)

chrisw23
chrisw23 il 28 Apr 2022
Maybe this helps.
tbl = array2table(b);
tbl.b1
tbl.b2
tbl.b3
% see also tbl.Properties

Categorie

Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by