CS 1371 Lecture Notes - Lecture 7: Matlab, Switch Statement, European Route E6
Document Summary
Give the values of the following variables after the script below is run. arr = [10, 17; 2, 4]; A= []; for col = 1:c for row = 1:r. B= r + col; end vec = zeros(1, 5); while isempty(vec) vec(end) = []; end. The first iteration, col = 1, row = 1, so we add arr(1,1) to a, giving us. The second iteration col = 1, row = 2, so we add ar(2,1), giving us a= [10 2] Similarly, we"ll then add the second column to the vector, so at the end of the loop, a= [10 2 17. B: the first time we run the outer loop, b= r+ col, r is equal to 2, and col = 1, and thus b= 3. C: c is equal to vec, which is set initially equal to zeros(1,5)->[0 0 0 0 0].