For this given code, what would the variable var equal?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Kristopher
am 21 Jun. 2014
Beantwortet: Image Analyst
am 21 Jun. 2014
What value does var have given the code fragment?
for index = 1:2:7
if index <= 4
var(index) = index;
elseif index == 5
var(index) = 2;
else
var(index+1) = 1;
end
end
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 21 Jun. 2014
Why not simply run it and find out?????
Just add var on a line by itself after the code you have and you'll see the value of var spit out to the command window. You'll see it says this:
var =
1 0 3 0 2 0 0 1
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Structures 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!