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
 Copying interpolated y-intercept values
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

DrMorbid

United Kingdom
14 Posts

Posted - 08/30/2014 :  4:06:20 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

I have >10 graphs, each of which has a linear fit applied to it. The idea is to interpolate the fits, find the y-intercept value for each graph and copy all these y-intercepts to a new sheet in a new book. In other words, I need to find threshold voltages for many devices I've made. So far I have this code, but I have no idea how I can copy the r3(0) values for each graph to the new book. I've tried to use csetvalues and wxt x-functions, but failed. Thank you very much for help in advance.

doc -e W { // loop over all sheets in all books
if (%H != "Book1") { // omit the VTH book, which will gather all the y-intercepts
page.active$ = "Linear fit curve1"; // set the -5 V linear fit table to be active
range r1 = sheet$!col(1); // x-values of the linear fit
range r2 = sheet$!col(2); // y-values of the linear fit
range r3 = (r2, r1);
r3(0)=; // interpolated y-intercept of the linear fit to the original data
};
else break;
};

Kathy_Wang

China
159 Posts

Posted - 09/01/2014 :  05:46:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Perhaps it is easier to directly assign the value in r3(0) to a worksheet cell (row i and column j) within each loop using col(j)[i] = r3(0), so could be something like:


//First define a range variable as a column in the "new book"
range rr = [Book1]Sheet1!col(1); //Change book/sheet name or column index if needed
//Define an integer as a counter for loops
i = 1;
doc -e W { // loop over all sheets in all books
%H=;
if (%H != "Book1") { // omit the VTH book, which will gather all the y-intercepts
page.active$ = "FitLinearCurve1"; // set the -5 V linear fit table to be active, the default name is usually "FitLinearCurve1"
range r1 = !col(1); // x-values of the linear fit in active worksheet
range r2 = !col(2); // y-values of the linear fit in active worksheet
range r3 = (r2, r1);
r3(0)=; // interpolated y-intercept of the linear fit to the original data
rr[i] = r3(0);//Assign interpolated value to a corresponding cell
i = i + 1;
}
else break;
}


Kathy
Originlab
Go to Top of Page

DrMorbid

United Kingdom
14 Posts

Posted - 09/01/2014 :  5:20:32 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Xie xie Kathy! This code worked well!
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