MATLAB: How do you print only the final iteration of a for loop

finalfor looploopprint

If I use a semi-colon, it suppresses all the output. But if I don't use one, it prints out every iteration. What do I use to only print out the final iteration of a for loop?

Best Answer

for ii = 1:10
display_me = %something;
end
display_me
You could add an if statement inside the loop to avoid unnecessary copying.
Please accept the answer that best solves your problem.
Related Question