How do I give order or number for "a" with ijk in the following code ? Please help me
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
mohammed elmenshawy
am 30 Mär. 2020
Kommentiert: mohammed elmenshawy
am 30 Mär. 2020
for example :
a_ 111= 2
a_112=4
a_234=48
and so on
In other words, how do I show the " a" rank? and how is "a" data recorded in order to be called again?
0 Kommentare
Akzeptierte Antwort
Birdman
am 30 Mär. 2020
What you are trying to do is not recommended in MATLAB since dynamically creating variables is not useful. You have several other options about creating variables. I suggest you to read the following tutorial:
For your problem, following code should do it:
for i=1:3
for j=1:4
for k=1:5
eval(sprintf('a_%d%d%d=2*%d*%d*%d',i,j,k,i,j,k));
end
end
end
Please read the tutorial in order to understand what I meant.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Variables finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!