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
 Problems with rescale and GetPts
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Koguma

Brazil
Posts

Posted - 07/26/2006 :  4:50:52 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Origin 7.0):
Operating System: Windows XP

Hi!
Well my question is a litle complicated.
My code open a worksheet, make a graph from x e the first y and get 2 points of the graph.
The problems is i need to rename the column where the 2 points had been kept.I just created the dataset that contains the 2 points, but not open.If the dataset will be opened, does not show all the points to the graph.The line "layer -a" does work!!! But, if i put the command in the lab talk console, it works perfectly!
For more details see the code below:

win -a %h;
worksheet -s 2 0 2 0;
worksheet -p 200 Origin;
layer -a;
create line -d 2;
edit line;
work -n 2 B;
win -a %h;
GetPts -n line 2;

Please help me and forgive my English!

Deanna

China
Posts

Posted - 07/26/2006 :  11:11:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I am not sure about if I get you wrong. It seems that your code is trying to do the following:
1) Create a plot from an existing worksheet.
2) Create a dataset and rename its second column.
3) Use datareader to read two points on the graph and save their XY values in the dataset.

Please correct me if there is anything wrong. It will help us understanding your question.




Deanna
OriginLab GZ Office
Go to Top of Page

Koguma

Brazil
Posts

Posted - 07/28/2006 :  01:08:47 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
i need to create a plot form a opened worksheet, but if i open the dataset i cant rescale the plot.If i canot open i cant rename the column.Basically this is my problem.
Go to Top of Page

Deanna

China
Posts

Posted - 07/28/2006 :  04:51:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:

i need to create a plot form a opened worksheet, but if i open the dataset i cant rescale the plot.If i canot open i cant rename the column.Basically this is my problem.




Please help me with the following:
1) Do you want to rename the second column of the worksheet Line?
2) I am not quite sure about what you want with rescaling? Do you want to rescale the graph according to the two points you select with the data reader? That means from

to


Deanna
OriginLab GZ Office

Edited by - Deanna on 07/28/2006 04:57:39 AM
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 07/28/2006 :  04:55:02 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I'm not sure why you use create -n to create the worksheet. You can either use create -wd to create the columns but not the worksheet or win -t Data to create a normal worksheet from the default wks template whose column names are already A and B. If you do the latter first save the graph window name and reactivate the graph before executing the GetNPts command.

Also win -a %h activates the already active window and is therefore redundant. And layer -a is unnecessary after wo -p because the latter command performs the scaling.

wo -s 2 0 2 0;
wo -p 200 Origin;
create Line -wd 2 A B;
GetPts -n Line 2;

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 07/28/2006 04:57:39 AM
Go to Top of Page

Koguma

Brazil
Posts

Posted - 08/03/2006 :  11:15:05 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:

I'm not sure why you use create -n to create the worksheet. You can either use create -wd to create the columns but not the worksheet or win -t Data to create a normal worksheet from the default wks template whose column names are already A and B. If you do the latter first save the graph window name and reactivate the graph before executing the GetNPts command.

Also win -a %h activates the already active window and is therefore redundant. And layer -a is unnecessary after wo -p because the latter command performs the scaling.

wo -s 2 0 2 0;
wo -p 200 Origin;
create Line -wd 2 A B;
GetPts -n Line 2;

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 07/28/2006 04:57:39 AM



the function getpts doesn't work in this code...


quote:

Please help me with the following:
1) Do you want to rename the second column of the worksheet Line?
2) I am not quite sure about what you want with rescaling? Do you want to rescale the graph according to the two points you select with the data reader? That means from




Yes...when i create a worksheet whith columns name A and B, and the function getpts get the points, they are stored in another column Y,not in B.
The rescaling problem appears when i open the worksheet line. my plotted graph doest showed with the normal y values and i cant get the points that i need.
I hope to have been clearly!
Thanks for the helping!

Edited by - Koguma on 08/03/2006 11:19:02 AM
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 08/03/2006 :  1:10:04 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Both the create -d and GetPts -n commands take Y dataset names, not worksheet names, as arguments. This works...

wo -s 2 0 2 0;
wo -p 200 Origin;
create Line_B -d 2;
GetPts -n Line_B 2;

...Note that adding layer -a after GetPts will not work because rescaling will occur before any points are selected. To rescale after each point selection you need to define and use the PointProc macro as shown below.

wo -s 2 0 2 0;
wo -p 200 Origin;
create Line_B -d 2;
layer -i201 Line_B; // add to layer as scatter
getpts.max=2; // select 2 pts
def pointproc {
Line_A[getpts.count]=x;
Line_B[getpts.count]=y;
layer -a; // rescale
if(getpts.count==getpts.max) dotool 0; // quit
};
dotool 2; // open screen reader

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 08/03/2006 1:34:20 PM

Edited by - Mike Buess on 08/04/2006 08:17:41 AM
Go to Top of Page

Koguma

Brazil
Posts

Posted - 08/07/2006 :  1:47:33 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks..."create Line_B -d 2" resolve my problems!!!
Thanks again!
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