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
 Collecting data in one workbook
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

vart3

6 Posts

Posted - 04/18/2016 :  01:20:10 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 9.1
Operating System:Windows

I have 35 curves/worksheets.The 35 worksheets have the format as shown in the picture

I am collecting the intersection values with the axes for each of the 35 curves in a new workbook. I want the format presented below as output file, where the first column is the name of the source file (35 in total), the second column is the value of the y-axis intersection, and the third column the x-axis intersection.





I am using this code in order to create my output file, which I called as "Resistances_VRT-I-61G#2".

string workBookDevice = "Resistances_VRT-I-61G#2";
newbook name:=workBookDevice$ sheet:=1 option:=lsname;
workBookDevice$Sheet1!col(1)[L]$ = "Device";
workBookDevice$Sheet1!col(2)[L]$ = "Voc";
workBookDevice$Sheet1!col(2)[U]$ = "(V)";
workBookDevice$Sheet1!col(3)[L]$ = "Isc";
workBookDevice$Sheet1!col(3)[U]$ = "(A)";

int kk = 1;

doc -ef LB // Loop through all individual sheets in all books in the current Project Explorer folder
{

if(page.name$!=workBookDevice$)
{

kk++;
// Voc and Isc
range r1 = col(1);
range r2 = col(2);
r2(0)=;
r1(0, r2)=;

// Device Column
string strC$ = col(1)[C]$;
type strC$;

// Write in
[workBookDevice$]Sheet1!cell(kk,1)$=strC$;
[workBookDevice$]Sheet1!cell(kk,2)=r1(0, r2);
[workBookDevice$]Sheet1!cell(kk,3)=r2(0);

}

}

kk=


However, I see that my program does 37 iterations and not 35 as it is my intention. Then, I am getting in the output file errors and empty rows.

I would appreciate to have any suggestions to understand why this is happening and try to have my code working in the way I want.

Thank you

jasonzhao

China
262 Posts

Posted - 04/19/2016 :  03:12:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

Would you please send the OPJ file to us (by mail: tech@originlab.com) for further test?



Best regards!
Jason
OriginLab Technical Service
Go to Top of Page

SeanMao

China
288 Posts

Posted - 04/19/2016 :  05:17:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I have written the scripts for a simple case:

Int ii=1;
Doc -ef LB
{
If(%H!="Results") // exclude the results sheet
{
Range rDevice = ["Results"]Sheet1!col("Device");
Range rVoc = ["Results"]Sheet1!col("Voc");
Range rlsc = ["Results"]Sheet1!col("Isc");
String strC$ = col(1)[C]$;
Double voc = col(1)[1];
Double lsc = col(2)[1];
rDevice[ii]$ = strC$;
rVoc[ii] = voc;
rlsc[ii]=lsc;
ii++;
}
}


The testing data and results are shown below:


You can modify your codes according to this example.

Regards!

Sean

OriginLab Tech.

Edited by - SeanMao on 04/19/2016 05:27:04 AM
Go to Top of Page

vart3

6 Posts

Posted - 04/19/2016 :  4:01:19 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Jason and Sean. I emailed my opj to tech@originlab.com, as my code is not working yet after your suggestions.

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