The preceding statements are part of a userwritten mfile fun

The preceding statements are part of a user-written m-file function. When MATLAB runs that function what happens? (Choose the best answer from the following options.) It prints and error message it changes the value of s to 3.0 it changes the value of s to 1.0 it leaves the value of s undefined outside of the loop

Solution

n=3;
s=0.0;
for i = 1: length(n)
s= s+1
end

ans :

s =

1

it changes the value to s =1

 The preceding statements are part of a user-written m-file function. When MATLAB runs that function what happens? (Choose the best answer from the following op

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site