What does the code below means
1 view (last 30 days)
Show older comments
ind = strfind(method,'##$PVM_NMovieFrames=');
ind = ind+20;
buff='';
n=1;
while method(ind)~= '$'
buff(n) = method(ind);
ind = ind+1;
n = n+1;
end
Question 1: why would i need a buff=' '
Question 2:why would the condition needs to have ~
1 Comment
Adam
on 11 May 2015
Edited: Adam
on 11 May 2015
Can't you tell us what the purpose of the code is? Whether you need either of the things you query in your two questions is not at all obvious without understanding what the intent of the code is.
buff = ''
looks superfluous, but you can easily find out by removing it. If you get an error then it is clearly needed as initialisation..
~ means NOT so the loop is presumably supposed to end when method(ind) is a '$'.
Accepted Answer
Walter Roberson
on 11 May 2015
You need the initialization because method(ind) might be equal to '$' immediately.
0 Comments
More Answers (1)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!