the application is to write the console output in case of a double for
---------------------------
code------------------------------------------------------
for Counter1=1:10
disp(['Counter 1 (main) ' num2str(Counter1) ' of 10'])
for Counter2=1:10
disp([num2str(Counter2) ' of 10']) %I want to rewrite this
line each time. Keeping the Counter1 display.
pause(0.1)
end
end
---------------------------end
code-----------------------------------------
the output I want to achieve is the same as this one, but in my
application the "second for" is inside a function and I do not have
the information to display the "counter 1"
---------------------------
code------------------------------------------------------
for Counter1=1:10
for Counter2=1:10
clc
disp(['Counter 1 (main) ' num2str(Counter1) ' of 10'])
disp([num2str(Counter2) ' of 10']) %I want to rewrite this
line each time. Keeping the Counter1 display.
pause(0.1)
end
end
-----------------------end
code-----------------------------------------------------
try this :
for Counter1=1:10
fprintf('Counter 1 (main) %d of 10\n',Counter1);
fprintf(' 0 of 10');
for Counter2=1:10
fprintf('%c%c%c%c%c%c%c%c%2d of
10',8,8,8,8,8,8,8,8,Counter2)
pause(0.1)
end
fprintf('\n')
end
Jerome (Dut)
I was looking for some command like "clcl" clear command
line or something, but this also helps.
Thanx,
Haritz
Have you found, since then, any other way of deleting single lines or some lines in the command windows without using fprintf command??
It's only a few days since I have come back to matlab and I am writing sample programs to review m language.
I need to update two counters on two different, consecutive lines.
I am sure it can be done exploting the code up here in this post but I need some help.
Thanks in advance
> Have you found, since then, any other way of deleting single lines or some lines in the command windows without using fprintf command??
I can't think of a single reason why that sort of thing would be
useful.
> It's only a few days since I have come back to matlab and I am writing sample programs to review m language.
> I need to update two counters on two different, consecutive lines.
> I am sure it can be done exploting the code up here in this post but I need some help.
If you are running the same set of commands over and over then
write a script. If you run the same set of commands with different
parameteres write a function.
Rune