You can create a shape with an object textand update its property 'string'according to the required variable:
h = text(.5, .5, ''); %// create text object
for n = 1:1000
v = n^2; %// loop computations here. Variable `v` is to be displayed
set(h, 'string', ['Value: ' num2str(v)]);
drawnow %// you may need this for immediate updating
end
For greater speed, you can only update every Siteration:
h = text(.5, .5, ''); %// create text object
S = 10; %// update period
for n = 1:1000
v = n^2; %// loop computations here. Variable `v` is to be displayed
if ~mod(n,S) %// update only at iterations S, 2*S, 3*S, ...
set(h, 'string', ['Value: ' num2str(v)]);
drawnow %// you may need this for immediate updating
end
end
drawnow('limitrate'), @Edric:
h = text(.5, .5, ''); %// create text object
for n = 1:1000
v = n^2; %// loop computations here. Variable `v` is to be displayed
set(h, 'string', ['Value: ' num2str(v)]);
drawnow('limitrate')
end