MATLAB: Estimate time needed for a code to finish

waitbar

Hi: I am not sure if my problem can be solved. I ran a code in matlab approximately two weeks ago. I have ran a similar one before and it took around 4 or 5 days and I was able to get the result but this current code is still processing! I wish I have included a function or something that could track the processing and let me know how much time is left. I do not like to stop the code, is there any way I could know how much is left or when the code will finish processing?
thanks
Naema

Best Answer

This is my favourite solution:
tic
for i = 1:1e9
if toc > 10
fprintf('Iteration %d/%d\n',i,1e9)
tic
end
% Very hard calculation
end