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
 Failed to initialize range from string

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
j4quinn Posted - 02/13/2015 : 2:04:41 PM
Hello,

This code is apart of a bigger file; however, i believe i have narrowed the problem to this piece of code. The code worked for OriginPro 8.5, but fails in 2015.

The exact error is
"Failed to initialize range from string, VarName = iy, VarValue = (Col(1)[dsB:dsE],Col(3)[-1:-1])
#Command Error!"

The code i believe has the problem:

// Get the beginning and ending index of data selector range into dataset objects
dataset dsB, dsE;
mks ob:=dsB oe:=dsE; // get index of points from data markers in data plot

window -a %(procWrkBk$); // bring workbook back to the foreground
[procWrkBk$]!page.active = ii; // activate 'i'-th worksheet in workbook

// do Linear Regression analysis on the data selection
fitLR iy:=( col(1)[dsB:dsE], col(3)[dsB:dsE] ); // get slope of sqrt(abs(I_D)) v.s. V_g



any suggestions would be great. How about the col(1)[dsB:deE) is that correct or do we need to give an index for datasets?

thanks in advance
3   L A T E S T    R E P L I E S    (Newest First)
j4quinn Posted - 02/18/2015 : 11:01:25 AM
resolved by using ranges

// Get the beginning and ending index of data selector range into dataset objects
dataset dsB, dsE;
mks ob:=dsB oe:=dsE; // get index of points from data markers in data plot

// type dsB: $(dsb) and dsE: $(dsE);

window -a %(procWrkBk$); // bring workbook back to the foreground
[procWrkBk$]!page.active = ii; // activate 'i'-th worksheet in workbook

range c1 = col(a)[dsB:dsE];
range c3 = col(c)[dsB:dsE];

// type c1: $(c1) and c3: $(c3);

// do Linear Regression analysis on the data selection
fitLR iy:=( c1, c3 ); // get slope of sqrt(abs(I_D)) v.s. V_g

jasonzhao Posted - 02/16/2015 : 02:17:22 AM
Hello,

Would you please see the graph below for the usage of mks;



Best regards!
Jason
OriginLab Technical Service
j4quinn Posted - 02/15/2015 : 09:26:48 AM
I found this in the labtalk tutorials

"When there are no data markers on the graph, both variables are equal to -1."

However, when we run the script we do see markers on the graph and we do move them along the graph to get the indices. It appears though that the indices are not saved to the mks. Why would this happen?

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