CS 1371 Lecture Notes - Lecture 7: Matlab, Switch Statement, European Route E6

62 views6 pages

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].

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents