The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Accessing the status bar with LabTalk
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ChristianJ

Germany
22 Posts

Posted - 12/01/2015 :  10:21:30 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. OriginPro 2015G (64-bit) Sr2
Operating System: Windows7


Hello Experts
I'm wondering if it is possible to get access to the status bar with LabTalk. I have some "set value scripts", which are really slow. It would be just fine to get an information about the status of such calculations - like "##% done", refreshed every 1000th iteration. (Over all, about 15s after starting the calculation, Origin is "Not Responding" untill the end of the calculation. I assume, this could be a little problem when trying to access the status bar...)

kfauth

Germany
33 Posts

Posted - 12/02/2015 :  05:05:15 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
you may use

type -q  some string

"-q"
is the option to display
some string
in the status bar.
Go to Top of Page

ChristianJ

Germany
22 Posts

Posted - 12/02/2015 :  07:25:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi kfauth
this was exactly what I was looking for! Dankeschön

But as I assumed it is a problem that Origin is not responding after a couple of seconds... Any hints for this?

Edited by - ChristianJ on 12/02/2015 07:25:53 AM
Go to Top of Page

kfauth

Germany
33 Posts

Posted - 12/02/2015 :  07:55:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Not from my side, sorry. I would like to think that in general this is not so much an "Origin not responding" thing, but rather a means to speed up the calculation. Updating the display can take a huge amount of time which you'd like your computer to spend on calculating.
I have seen such things also with other code (outside origin) I have written. All of asudden, when the screensaver came in, my code executed almost 10 times faster...

But an option to update -- not on every iteration -- but ocasionally, as you write, would really be interesting in order to know whether you can go out for lunch, have a coffee or something, before the calculatin is finished.

Therefore I also would welcome a comment by Originlab Tech staff.
Go to Top of Page

SeanMao

China
288 Posts

Posted - 12/02/2015 :  10:52:33 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

You can create a Progress Bar to know the progress, a sample code would be as following:


break -b This is the caption for the dialog box;  
break -r 0 100;  // the range of values will be 0 - 100 
for (ii = 0; ii <= 100; ii=ii+5) // Show every 5 percentage 
{
      break -p ii;   // the current value is ii
      csetvalue col:=col(a) formula:="i";// Put your code here
      csetvalue col:=col(b) formula:="cos(col(a))";
      //sec -p .1;   // Delay to simulate executing code
};
break -end;  // done, close the dialog box


Hope this can be some help.

Regards!

Sean

OriginLab Tech.
Go to Top of Page

ChristianJ

Germany
22 Posts

Posted - 12/03/2015 :  03:02:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi kfauth
You're right: The script is definitely too slow and must be optimized. But that would be another topic But I think the screenupdating thing is not the problem. Origin seems not to update anything while it is calculating. But I know what you mean - in Excel-VBA the turned off screenupdating is solving 90% of the speed problems.

Hi Sean
thank you for your reply. While it is not exactly what I was looking for, it is even better. But the best about the break command is, it is preventing that Origin is getting not responding. Great!

Here is my code:

string str1$ = __lastwks$;

range r1 = [str1$]6!11; //the target column
range r2 = [str1$]6!5; //the source column (the values must be summarized row by row)
range r3 = [str1$]6!10; //the condition column (a one in this column sets the sum to zero)

r1 = {1: r2.GetSize()}; //the worksheet will have about 100000 rows
r1 = 0;

int jj = 0;
break -b "Count something";  
break -r 0 r1.GetSize();

//iterating through all rows seems to be very slow...
for (ii=2; ii<r1.GetSize(); ii++)
{

    if(r3[ii] == 0)
    {
        r1[ii] = r1[ii-1] + r2[ii];
    }

    if(r3[ii] == 1)
    {
        r1[ii] = 0;
    }

    jj++;
    if(jj == 1000) 
    {
        jj = 0;
        break -p ii;
    }    
} 

break -end;
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000