[Scilab-users] Scilab API sciprint to print on the same line

Chin Luh Tan chinluh.tan at bytecode-asia.com
Thu Dec 12 17:10:32 CET 2019


Hi Samuel, 



Thanks for your reply. 



Previously I was using clc(linenumtoclear) for showing this effect in scilab, but i never thought of the mprintf, i was using disp that time



for i = 1:100 

disp("Static counter : " + string(i)); 

sleep(1); clc(1) 

end


it seems that the mprintf also kind of broken? as it needs 3 \n to get this result?

I also tried to look into the clc C source and see whether I could use the c code of clc in scilab api but no luck, but your example of mprintf which need 3 \n inspired me to look into the mprintf c code and see how it works. 

I will get back to you on this, thanks again.

rgds,
CL

---- On Thu, 12 Dec 2019 04:09:25 +0800 Samuel Gougeon <mailto:sgougeon at free.fr> wrote ----


Le 11/12/2019 à 14:31, Chin Luh Tan a
      écrit :





In the C API i don't know, but in Scilab language, http://bugzilla.scilab.org/show_bug.cgi?id=14642.

It is possible to mimik it with (example):

for i = 1:100
    mprintf("Static counter: %d\n \n\n",i)
    sleep(300)
    clc(1)
end

Samuel




_______________________________________________
users mailing list 
mailto:users at lists.scilab.org 
http://lists.scilab.org/mailman/listinfo/users 
Hi,



I am trying to print some progress of a for loop in C api
          which will print the output in scilab console using the
          sciprint.



Is there anyway to print the output to a same line as
          normal C printf could be achieved using '\r' ? 



e.g.:



currently my out out showing:



Train Epoch: 10 [ 1000/15416] Loss: 0.5961 

Train Epoch: 10 [ 2000/15416] Loss: 0.6794

Train Epoch: 10 [ 3000/15416] Loss: 0.3965

Train Epoch: 10 [ 4000/15416] Loss: 0.8110

Train Epoch: 10 [ 5000/15416] Loss: 0.7892



I would like to have the output to show on the same line. 



I tried \r with fflush(stdout) it seems not working.



Thanks.



rgds,

Chin Luh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20191213/ff274ddd/attachment.htm>


More information about the users mailing list