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
 Problem on debugging

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
rakun Posted - 05/27/2024 : 03:07:08 AM
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?
1   L A T E S T    R E P L I E S    (Newest First)
aplotnikov Posted - 05/27/2024 : 06:06:52 AM
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.

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