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
 Problem on debugging
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

rakun

Germany
1 Posts

Posted - 05/27/2024 :  03:07:08 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I'm so new to the Origin and I need to plot a huge data set but not all columns are necessary so I need to write a script.

I need to select (x,y) pairs with respect to the following parametrization

parm = floor((end - start) / (i * 2)) + 1;

so my script is

double start = 1;
double end = 200;
double i = 20;

int parm = floor((end - start) / (i * 2)) + 1;

int X[parm];
int Y[parm];

for (int k = 0; k < parm; k++) {
X[k] = start + k * i * 2;
Y[k] = X[k] + 1;
}


for (int k = 0; k < parm; k++) {
if (X[k] <= end) {
wks.colSel(X[k], 1);
}
if (Y[k] <= end) {
wks.colSel(Y[k], 1);
}
}

I keep receiving "#Command Error!". I just can't understand where is the problem. Does anyone have any suggestion?

Edited by - rakun on 05/27/2024 03:12:53 AM

aplotnikov

Germany
169 Posts

Posted - 05/27/2024 :  06:06:52 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
LT does not support array declaration in C-style with square brackets, you have to use loose datasets instead:
dataset dsX, dsY;
int k;
loop(k, 1, parm) {
   dsX[k] = start + (k-1) * i * 2;
   dsY[k] = dsX[k] + 1;
}


https://www.originlab.com/doc/de/LabTalk/ref/Datasets

PS. You can save time by reading of manuals.
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