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
 plotxy changes the input datasets?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

JokerOne

Germany
58 Posts

Posted - 02/24/2016 :  11:26:09 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 9.1 and Service Release 1(Select Help-->About Origin):
Operating System Win 7

When I am trying to plot a few points using plotxy and datasets as input I experience a strange behaviour:

Please see the following code:
@global=1;
dataset x_point,y_point;

x_point[1] = 1;
y_point[1] = 1;

helper1 = x_point.GetSize();
type "$(helper1)";
plotxy iy:=(x_point,y_point) plot:=201 ogl:=[Strange_Plot]1! color:=2;

helper1 = x_point.GetSize();
type "$(helper1)";


The Output of this code is:
1
100
, i.e. calling GetSize the first time will result in one entry in x_point, while calling it after the plotxy call, the x_point dataset now contains 100 elements.

In addition, the plot itself contain "TWO" points, namely (1/1) as expected but also (0/0) which actually corresponds to the 99 additional entries in x_point and y_points, which are all 0/0.
I.e.
x_point[2] = 0 , etc...

How can I avoid such a behaviour of plotxy?

Thank you

JokerOne

Germany
58 Posts

Posted - 02/24/2016 :  12:09:53 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Update, it is getting more confusing...

I tried to use RANGES instead of datasets:

dataset x1,y1;

x1[1] = 1;
y1[1] = 1;

range xr = [??]!x1;
range yr = [??]!y1;

newbook;
col(a) = xr;
col(b) = yr; // seems to be ok (1/1) is shown in a worksheet

int helper1 = x1.GetSize();
type "$(helper1)";


plotxy iy:=(xr,yr) plot:=201 ogl:=[Strange_Plot]1! color:=1 rescale:=1; // Plot fitted curve

int helper1 = x1.GetSize();
type "$(helper1)";


With this code:
1.) The resulting plot is empty: no datapoints are displayed
2.) The size of x1 still changes from 1 to 100 anywhere at the plotxy call, although x1 is not even part of plotxy (only the range pointer xr).

Go to Top of Page

JokerOne

Germany
58 Posts

Posted - 02/25/2016 :  03:28:17 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Ok,

I am about to - well, not really understand this, but know how to handle this:

From the LabTalk manual I learned that:
"dataset xx"
creates a "Temporary loose dataset", which "cannot be used for plotting". Actually, IMHO, this is not precisely correct, as it can be used for plotting (no error message...) but the results are rubbish.

When instead one just goes ahead with
xx = {1}
one creates a "Project Level Loose Dataset", that "can be used for plotting".
When I change my code accordingly, then, indeed, the plotting is correct.

Now still, the plotxy does some magic to the dataset "project loose" or "temporary loose" as the Size is suddenly increased to 100.

Now, if you prefer to avoid this, hand over the dataset to a dummy variable - do not define this dummy variable with "dataset..." - and use this dummy variable in the plot:


x_point = {1};
y_point = {1};

helper1 = x_point.GetSize();
type "$(helper1)";
x_point_plot = x_point;
y_point_plot = y_point;

plotxy iy:=(x_point_plot,y_point_plot) plot:=201 ogl:=[MyGraph]1!;

helper1 = x_point.GetSize();
type "$(helper1)"; // Size remains 1!


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