For loops question Help
Show older comments
Can someone please explain the steps to this problem for me?
What is the variable y as the result of the given Matlab code fragment?
index = 1;
x = [3 -1 2 4 6];
test = [2 5 1 3];
for var = test
y(index) = x(var);
index = index+1; end y = -1 6 3 2
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!