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
 Collecting data in one workbook

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
vart3 Posted - 04/18/2016 : 01:20:10 AM
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
3   L A T E S T    R E P L I E S    (Newest First)
vart3 Posted - 04/19/2016 : 4:01:19 PM
Thanks Jason and Sean. I emailed my opj to tech@originlab.com, as my code is not working yet after your suggestions.

SeanMao Posted - 04/19/2016 : 05:17:57 AM
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.
jasonzhao Posted - 04/19/2016 : 03:12:09 AM
Hello,

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



Best regards!
Jason
OriginLab Technical Service

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