how to code variable to code

2 Ansichten (letzte 30 Tage)
Anantachai Chotkamsri
Anantachai Chotkamsri am 3 Jul. 2019
like in box name have s1 s2 s3 s4 s5 s6 .. sn
s1 = 1
s2 = 2
s3 = 3
sn = n
**************************
for i=1:n
s<i> do something
end
************
behind s<> how to code variable to code

Antworten (1)

madhan ravi
madhan ravi am 3 Jul. 2019
  8 Kommentare
Stephen23
Stephen23 am 3 Jul. 2019
@Anantachai Chotkamsri: what is stopping you from just using indexing?
Indexing is simple, neat, and very effiicient (unlike what you are trying to do).
Indexing is also explained in the introductory tutorials:
and also explained in the link that madhan ravi gave you.
Anantachai Chotkamsri
Anantachai Chotkamsri am 3 Jul. 2019
thank you so much for help everyone. <3

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by