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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 multiple data selector operations

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
annekin Posted - 03/05/2006 : 5:56:23 PM
Origin Version (Select Help-->About Origin): 7.G
Operating System:Win XP

Hi

I have a plotted graph from which I need the user to select the relevant data range. Since there can be more than one relevant data range I put the whole selection procedure in 'while'loop. Like this:

var=1;zahl=0;
for ( ;var >0;) //while loop
{
dotool 4;// data selector tool
def pointproc {
zahl=zahl+1;
getstring (peak name) C1s;
peak_Name[zahl]$=%B;
%A=xof(%C);
peak_Emin[zahl]=%A[mks1];
peak_Emax[zahl]=%A[mks2];
getyesno (add range?) var;
done=1;
};
for (done=0; done ==0; ) {sec -p .05}; // Wait until done=1
};

For the first data range this works fine. But if I want to add a second range I get the same values as before even though I moved the data markers.

Any suggestion why this doesn´t work?

Best regards,

Anita
3   L A T E S T    R E P L I E S    (Newest First)
Laurie Posted - 03/13/2006 : 2:22:29 PM
Hi Anita,

If you rewrite your code as follows, you will not need to use the sec -p command to wait:

zahl=1;
def newrange {


dotool 4;

def pointproc {
zahl++;
getstring (peak name) C1s;
peak_Name[zahl]$=%B;
%A=xof(%C);
peak_Emin[zahl]=%A[mks1];
peak_Emax[zahl]=%A[mks2];

dotool 0;

getyesno (Add Range?) done;

if(done==1) newrange;

};

};

dotool 4;

def pointproc {

getstring (peak name) C1s;
peak_Name[zahl]$=%B;
%A=xof(%C);
peak_Emin[zahl]=%A[mks1];
peak_Emax[zahl]=%A[mks2];

dotool 0;

getyesno (Add Range?) done;

if(done==1) newrange;

};


OriginLab Technical Support
annekin Posted - 03/07/2006 : 02:54:10 AM
Thank you Laurie for your advice.

The script now works. But still I need the
for (done=0; done ==0; ) {sec -p .05};
waiting loop because otherwise the rest of the script continues without waiting for the input data. I don't know how else to put the rest of the script on hold until the data selection is finished.

There is also one more minor problem. When the data selector tool is first called, the data markers are visible but I still see the point selector symbol and I can't move the data markers. Only when I change to another window and then back to this graph window everything is as it should be. After that it works also for all other calls of the data selector tools.
I suspect it has something to do with the data markers assuming positions saved before. Because when I switch between the left and right data marker by using the arrow keys, the red crosses indicating the marker positions take some weird positions in the middle of the graph window but nowhere near the curve.
doc -uw and plot -c doesn't seem to help either.

Best regards,
Anita
Laurie Posted - 03/06/2006 : 2:33:36 PM
Hi Anita,

It is because your PointProc macro is missing the 'dotool 0;' command.

Below is an alternative solution. I define another macro within the Pointproc macro, and in this way, avoid the need of the 'sec -p' to pause the code from running. The GetYesNo command will set the value of the 'done' variable to 1 if the user clicks Yes

dotool 4;
def pointproc {
mks1=; //output value of left marker
dotool 0;
getyesno (Add Range?) done;
if(done==1)
{
def newrange {
dotool 4;
def pointproc {
mks1=;
dotool 0;
getyesno (Add Range?) done;
if(done==1) newrange;
};
};
newrange;
}
};



The code could also look like this:

def newrange {
dotool 4;
def pointproc {
mks1=;
dotool 0;
getyesno (Add Range?) done;
if(done==1) newrange;
};
};
dotool 4;
def pointproc {
mks1=;
dotool 0;
getyesno (Add Range?) done;
if(done==1) newrange;
};


Newrange could also be a section of code in an OGS file instead of a macro. In the PointProc macro definition, you'd replace newrange; with run.section(myOGSfile.ogs,newrange);.

-Laurie
OriginLab Technical Support

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000