MATLAB: How to run a function again and again till a condition satisfies

Hello, i have a function which i want to run again and again till the condition is fulfilled.
please please help me….

Best Answer

suchismita, see e.g.,
flag = false;
cnt = 0;
while ~flag
cnt = cnt + 1;
fprintf('Try no.: %d\n', cnt);
if (rand() < 0.25)
flag = true;
end
end
Your function would simply reside inside the loop.
Related Question