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
 Reading time values from integration

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
kdsaransh Posted - 11/28/2016 : 04:44:10 AM
Hello,

I am integrating col(2) wrt col(1)and placinig the value of area in another sheet in col(2).
This is what this code solves.

Now i also want to read the value of time1 (x1) and time2 (x2)in two column next to each other.


ii=1;
Doc -ef W
{
if (page.longname$!="Average Current")
{
integ1 iy:=(Col(1), Col(2)) area:=area; // integrate col 2 wrt col 1
range rTemp = ["Average Current"]1!col("Area")[$(ii)];
rTemp = area;
ii++;
}
};


Please help.

Thanks
22   L A T E S T    R E P L I E S    (Newest First)
yuki_wu Posted - 12/13/2016 : 02:48:45 AM
Hi,

If you don't want to rename your worksheet manually, you could try the first way that Alexei suggested.

Or you can rename worksheet with if structure:

doc -ef W
{
    if(condition that you set)
    {
       page.longname$ = NewWorkbookName; 
       layer.name$ = NewWorksheetName;
    }
}


Yuki
OriginLab
kdsaransh Posted - 12/13/2016 : 12:03:00 AM
Dear Yuki,

If you could also include the code for renaming the worksheets as said, because it is very difficult to rename lets say 100 workbooks manually.

Thanks and regards,
Rajesh Agarwal
yuki_wu Posted - 12/12/2016 : 10:41:58 PM
Hi,

It seems to me that the way suggested by Alexei is quite clear.

You can just rename your worksheets like "A0001kHz", "A0002kHz",..., "A0010kHz",..., "A0200kHz",...,"A2000kHz", where "A0200kHz" corresponds 20 kHz, and then use the code I gave above:

StringArray saWBNames;
doc -e W 
{
    saWBNames.Add(%H)
};
saWBNames.Sort();

loop(ii,1,saWBNames.GetSize()) 
{
    win -a %(saWBNames.GetAt(ii)$);
    if (page.longname$!="Average Current")
    {
        integ1 iy:=(col(1), col(2)) area:=darea x1:=dbeginning x2:=dending;
	range rArea = ["Average Current"]1!col(2)[$(ii)];
	range rBeginning = ["Average Current"]1!col(4)[$(ii)];
	range rEnding = ["Average Current"]1!col(5)[$(ii)];
	rArea = darea;
	rBeginning = dbeginning;
	rEnding = dending;
	ii++;
    }
}


Yuki
OriginLab
kdsaransh Posted - 12/12/2016 : 01:34:53 AM
Hi,

Waiting for some help...

Regards,
Rajesh Agarwal
kdsaransh Posted - 12/08/2016 : 07:30:21 AM
Hi,

OR if i could rename all the workbooks as you had suggested.

Regards
kdsaransh Posted - 12/07/2016 : 07:33:18 AM
Hello,

Thanks,
Can you pls modify the below code according to option 1 or 2, so that i may use it.

ii=1;
Doc -ef W
{
if (page.longname$!="Average Current")
{
integ1 iy:=(col(1), col(2)) area:=darea x1:=dbeginning x2:=dending;
range rArea = ["Average Current"]1!col(2)[$(ii)];
range rBeginning = ["Average Current"]1!col(4)[$(ii)];
range rEnding = ["Average Current"]1!col(5)[$(ii)];
rArea = darea;
rBeginning = dbeginning;
rEnding = dending;
ii++;
}
};
Again thanks a lot

Best regards,
aplotnikov Posted - 12/07/2016 : 06:22:25 AM
Hi,

1. Create workbook "Book1".
2. Fill column "A" of the workbook "Book1" with the _SHORT_ names of your workbooks to integrate in _desired_ order (e.g., "A100Hz",..., "A1kHz",...,"A100kHz",...).
3. loop(ii, 1, [Book1]1!wks.maxRows) {win -a %(Book1_A[ii]$);...}

or

rename your workbooks (_SHORT_ names!) to make possible a _correct_ sort operation on a string array. Like "A0001kHz", "A0002kHz",..., "A0010kHz",..., "A0200kHz",...,"A2000kHz", where "A0200kHz" corresponds 20 kHz.

Regards,

Alexei
kdsaransh Posted - 12/07/2016 : 05:57:23 AM
Dear alexei,

Sorry that i am not able to understand.

I have around 19 workbooks starting from 100hz to 200khz and i want to integrate all of them. There is no other workbook that except the ones i want to integrate.

thanks
aplotnikov Posted - 12/07/2016 : 05:53:17 AM
Hi,

please read our replies carefully. I wrote "workbooks with data to integrate" - not ALL the workbooks in your project! That means, ONLY those you need to integrate corresponding your selection criteria. Sorry, but I cannot explain more precisely.

Regards,

Alexei
kdsaransh Posted - 12/07/2016 : 05:40:20 AM
Dear ,

As you can see that the workbooks are placed in a separate folder. replacing doc -ef" instead of "doc -e gives me the same result.

Thanks and regards,
Rajesh Agarwal
aplotnikov Posted - 12/05/2016 : 08:23:58 AM
Hi,

1. Place workbooks with data to integrate in a separate project folder.
2. Use "doc -ef" instead of "doc -e" starting your script in the folder containing selected workbooks only.

or

make the list of the workbooks manually - either as a workbook or as a string array - with explicit input of workbook names in desired order. Then you can loop over the created dataset or string array.

Regards,

Alexei
kdsaransh Posted - 12/05/2016 : 05:43:58 AM
Dear Yuki,

As you can see from the attached pic that the integration is still not in sequence. The integration should start from 100hz and end at 200khz. but it goes like: 100hz, 100khz, 10khz, 120khz, 150khz, 15khz, 1khz, 200hz and so on.

Regards,
Rajesh Agarwal


yuki_wu Posted - 12/05/2016 : 03:02:22 AM
Hi,
	
StringArray saWBNames;
doc -e W 
{
    saWBNames.Add(%H)
};
saWBNames.Sort();

loop(ii,1,saWBNames.GetSize()) 
{
    win -a %(saWBNames.GetAt(ii)$);
    if (page.longname$!="Average Current")
    {
        integ1 iy:=(col(1), col(2)) area:=darea x1:=dbeginning x2:=dending;
	range rArea = ["Average Current"]1!col(2)[$(ii)];
	range rBeginning = ["Average Current"]1!col(4)[$(ii)];
	range rEnding = ["Average Current"]1!col(5)[$(ii)];
	rArea = darea;
	rBeginning = dbeginning;
	rEnding = dending;
	ii++;
    }
}


Yuki
OriginLab
kdsaransh Posted - 12/05/2016 : 02:04:41 AM
Dear yuki,

Can you pls modify the code accordingly. It will be very helpful...

Thanks in aDVANCE
yuki_wu Posted - 12/02/2016 : 01:48:28 AM
Hi,

Also in the post I mentioned above, you can find a link point to the detailed explanation of z-order:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms632599%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396#zorder

In short, if you want to loop the workbooks from A to D in turn, you should active the workbook windows like A-B-C-D one by one, and then save the project.

Regards,
Yuki
OriginLab
kdsaransh Posted - 12/01/2016 : 11:35:55 AM
Hello yuki,

I tried to put alexie code in between your code, but still the looping problem persists. Also the z order is out of my understanding.

if you could suggest.

yuki_wu Posted - 12/01/2016 : 02:18:40 AM
Hi,

We have discussed the sequence problem in this post:
http://www.originlab.com/forum/topic.asp?TOPIC_ID=22902

As what I mentioned in that post, the looping sequence follows the z-order. If you want to loop over the workbooks as you desired, the way that Alexei shared is useful.

Regards,
Yuki
OriginLab
kdsaransh Posted - 11/30/2016 : 07:15:38 AM
Thanks yuki,

but the sequence problem is still there. I am not able to figure out.

Any help ...


Regards,

yuki_wu Posted - 11/30/2016 : 04:46:25 AM
Hi,

I think you could modify your code as what I mentioned above:
	
ii=1;
    Doc -ef W
    {
        if (page.longname$!="Average Current")
        {
            integ1 iy:=(col(1), col(2)) area:=darea x1:=dbeginning x2:=dending;
	    range rArea = ["Average Current"]1!col(2)[$(ii)];
	    range rBeginning = ["Average Current"]1!col(4)[$(ii)];
	    range rEnding = ["Average Current"]1!col(5)[$(ii)];
	    rArea = darea;
	    rBeginning = dbeginning;
	    rEnding = dending;
	    ii++;
	}
    };

Hope it helps.

Regards,
Yuki
OriginLab
kdsaransh Posted - 11/30/2016 : 02:16:06 AM
Dear yuki,

Thanks for the reply.

I have two cols A(x) and B(y). A(x)is time col and B(y) is current col. Now i want to integrate col(B) wrt col(A). After integration, i get a value of area. The result log shows the value of area and the time (x1) and time (x2).

Now i want to put this value of area in col 2 of another sheet named as "Average Current". Also the value of time t(x1) and t(x2) in col 4 and 5 respectively.
Now i have many sheets and i want to do this same operation for all the sheets.

The value of each area and associated time (x1)and time (x2)should be in the file " Average Current".




Many many thanks....
yuki_wu Posted - 11/28/2016 : 9:42:46 PM
Hi,

In fact, I am not sure whether I understand your question fully. Do you want to know the beginning x(x1) and the ending x(x2)? If so, you can modify your script like below:


integ1 iy:=(Col(1), Col(2)) area:=darea x1:=dbeginning x2:=dending;
range rArea = ["Average Current"]1!col("Area")[$(ii)];
range rBeginning = ["Average Current"]1!col("Begin")[$(ii)];
range rEnding = ["Average Current"]1!col("End")[$(ii)];
rArea = darea;
rBeginning = dbeginning;
rEnding = dending;

Also, you can find more information about Integ1 X-Function here:
http://www.originlab.com/doc/X-Function/ref/Integ1

If not, would you please explain more clearly about what is time1(x1) and time2(x2) you want to know? You can upload an image in this post.

About the sequence of the loop, perhaps you can find the answer in this post:
http://www.originlab.com/forum/topic.asp?TOPIC_ID=22902

Hope it can be some help.

Regards,
Yuki
OriginLab
kdsaransh Posted - 11/28/2016 : 05:07:01 AM
Also the integration is not in sequence. That is if i have 10 books named 1,2,3,4,5,6,7,8,9 and 10. Then the integration should be performed in sequence, but is not going well with code. The integration is random and hence the area value is also random.

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