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
 plotxy changes the input datasets?

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
JokerOne Posted - 02/24/2016 : 11:26:09 AM
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

2   L A T E S T    R E P L I E S    (Newest First)
JokerOne Posted - 02/25/2016 : 03:28:17 AM
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!


JokerOne Posted - 02/24/2016 : 12:09:53 PM
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).


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