What does result mean inside a while loop in Matlab
while (some_condition == 1)
A = somefunc();
result(iteration) = A;
iteration = iteration + 1;
...
end
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The only reasonable option seems to be that
resultis a variable (array or matrix) defined outside of your while loop and you assign the valueAto indexiterationofresult.[Edit] The second option is:
resultis function taking as argumentiteration. While this is in theory possible, it makes no sense, since assigning a value to the result of a function in MATLAB will create a variable with that function’s name and as a result hide that function in the scope of the variable.E.g. try:
As you will see,
sum(b)does not return 6 (= b). It now returns the 6th element of the arraysum, which was set to 5 in the 2nd line of code. Access to the function just became impossible.