Store While Loop Output in Vector

6 Ansichten (letzte 30 Tage)
Briana Staheli
Briana Staheli am 11 Apr. 2019
Kommentiert: Briana Staheli am 11 Apr. 2019
Hi guys, I'm having a bit of difficulty storing the output of the while loop in a vector. Here's my code. For some reason the 'thetak' vector it creates is [0,0,045] when I enter [45,45,45,45]
n=input('Number of Layers?: ');
i=0;
while i<n
thetak(n)=input('Enter Orientation Angle: ');
i=i+1;
end

Akzeptierte Antwort

Matt J
Matt J am 11 Apr. 2019
Bearbeitet: Matt J am 11 Apr. 2019
while i<n
i=i+1;
thetak(i)=input('Enter Orientation Angle: ');
end
  1 Kommentar
Briana Staheli
Briana Staheli am 11 Apr. 2019
Wow that was way easier than i thought! thank you!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements 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!

Translated by