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
 Failed to initialize range from string
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

j4quinn

Canada
4 Posts

Posted - 02/13/2015 :  2:04:41 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

j4quinn

Canada
4 Posts

Posted - 02/15/2015 :  09:26:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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?
Go to Top of Page

jasonzhao

China
262 Posts

Posted - 02/16/2015 :  02:17:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

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



Best regards!
Jason
OriginLab Technical Service

Edited by - jasonzhao on 02/16/2015 02:18:31 AM
Go to Top of Page

j4quinn

Canada
4 Posts

Posted - 02/18/2015 :  11:01:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

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