A
is an array, what is A(2:5,3)
?A
is an array, what is A(2,1:4)
?Control statements controls the flow of execution of your code. There are different types of control statements:
A loop control statement allows a block of code to be executed repeatedly. There are two basic forms
A = ones(1,5)
for i = 1:4
A(i) = 2*i;
end
A loop can contain another loop.
A = ones(8,8)
for i = 1:5
for j = 2:7
A(i,j) = i+j;
end
end
Execution of statements inside a loop can be interrupted or diverted.
For today's exercise, complete the following tasks using "for" loops