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
 Interp1 with "Failed to resolve range stri " Error
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

franz_engel

2 Posts

Posted - 12/12/2013 :  03:12:12 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.6.0 (64bi)
Operating System: Windows 7

Hi,

I have a couple of "input" Workbooks (in my code i have only the "demo"-Workbook). The names of the workbooks are in an string array. My programm opens a new Workbook and insert a column with values from 580 to 10. The idea is to insert a new column (per input Workbook) into this destination Workbook. The column should be build by the interp1.
My code always raises this failure: "Failed to resolve range string, VarName = iy, VarValue = [demo]1!(Col(1),Col(2))"
Here is my code:
[Main]
string dest$="Auswertung_allPoints";
StringArray src;
src.Add("demo");


newbook sheet:=1 result:=bkn$;
wks.name$=dest$;
page.label$=dest$;
page.longname$=dest$;
range destWks=[dest$]1!;
destWks.col$(1).label$=Y_Equi;
destWks.col$(1).comment$=Equidistante Y Werte;
destWks.col$(1).type=1;
destWks.col$(1).format=1;


for(i=1;i<(5700);i++)
{
	double j=580-(i-1)*0.1;
	%(destWks)Col(1)[i]$=$(j);
};

loop(count,1,src.GetSize())
{
	string srcName$=src.GetAt(count)$;
	range srcWks=[srcName$]1!;
	int nlast=srcWks.nrows;
	for(int ii=nlast;ii>0;ii--)
	{
		%A=%(srcWks)Col(1)[ii]$;
		double aa=%A;
    	if((aa>88.0) || (aa<80.0))
    	{
    		range ra=%(srcWks)[ii];
    		del ra;
    	}
	};

	range iyy=%(srcWks)Col(1);
	range iyx=%(srcWks)Col(2);
	string srcTable$=src.GetAt(1)$;
	
	interp1 ix:=[Auswertung_allPoints]Auswertung_allPoints!Col(1) iy:=(iyy,iyx) ox:=[Auswertung_allPoints]Auswertung_allPoints!Col(2);
};

Edited by - franz_engel on 12/12/2013 03:18:17 AM

greg

USA
1379 Posts

Posted - 12/12/2013 :  2:22:20 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Your workbook is not named demo. When I run this in a new project:

// BEGIN SCRIPT
col(1)=uniform(100);
col(1)*=14;
col(1)+=78;
col(2)=data(1,100);
win -r %H demo;
string dest$="Auswertung_allPoints";
StringArray src;
src.Add("demo");
newbook sheet:=1 result:=bkn$;
wks.name$=dest$;
page.label$=dest$;
page.longname$=dest$;
range destWks=[dest$]1!;
destWks.col$(1).label$=Y_Equi;
destWks.col$(1).comment$=Equidistante Y Werte;
destWks.col$(1).type=1;
destWks.col$(1).format=1;
for(i=1;i<(5700);i++)
{
double j=580-(i-1)*0.1;
%(destWks)Col(1)[i]$=$(j);
}
loop(count,1,src.GetSize())
{
string srcName$=src.GetAt(count)$;
range srcWks=[srcName$]1!;
int nlast=srcWks.nrows;
for(int ii=nlast;ii>0;ii--)
{
%A=%(srcWks)Col(1)[ii]$;
double aa=%A;
if((aa>88.0) || (aa<80.0))
{
range ra=%(srcWks)[ii];
del ra;
}
}
range iyy=%(srcWks)Col(1);
range iyx=%(srcWks)Col(2);
string srcTable$=src.GetAt(1)$;
interp1 ix:=[Auswertung_allPoints]Auswertung_allPoints!Col(1) iy:=(iyy,iyx) ox:=[Auswertung_allPoints]Auswertung_allPoints!Col(2);
}
// END SCRIPT

the code works. At least, it does 'something' ;-)

But if I comment out the line
win -r %H demo;
then I get the same error you get.
All that line does is rename the Workbook to "demo".
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