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
 Origin Forum
 Unstack data on reaching a certain value

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
electrochemist2017 Posted - 09/27/2017 : 07:54:01 AM
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 2016G (32-bit) Sr1
Operating System: Win10 (64-bit)

Hello together,

I am working with electrochemical cycling data in ASCII format.
The cells are alternately charged and discharged, where the voltage of the cell is recorded in column C7(Y) and the corresponding capacity is in column C4(Y) until the next charge or discharge starts.

What I would like to do is split or unstack every charging and discharging part (Column C7(Y)) and the corresponding capacity (column C4(Y)) into extra columns by use of column C9(Y), where each charging or discharging block starts with 0 and ends with 133.



Is there a possibility to automate this so I can transfer it into an origin template?

Thank you in advance for any help
5   L A T E S T    R E P L I E S    (Newest First)
electrochemist2017 Posted - 03/06/2018 : 2:19:51 PM
Hello again

I tried now playing around with wunstackcol with the following script:
wunstackcol irng1:=(1:12) irng2:=col(2) sort:=data ow:=Sheet!1;
This in general recognizes the splitting condition correctly and but gives me just a single file like this:


Is it possible to use wunstackcol and put each stack in a new sheet?

Best,
Electrochemist2017
electrochemist2017 Posted - 03/04/2018 : 09:41:40 AM
Unfortunately I still have issues with a proper automation.
As I changed the device lately, the syntax of my file got a bit easier:



As you can see in the picture I have a column for Cycle number (Col(B)) and I would like to split that file into single files for each cycle present and rename them to something like filename_cycle1, filename_cycle2 or similar.

What I tried in addition is the unstacking tool, but this gave me only to columns with random looking data.

I successfully created an import filter which does some mathematical operations on the imported data, but the file splitting remains a big secret to me.

I would really appreciate any help regarding the scripting :)

Best,
electrochemist2017
nick_n Posted - 09/29/2017 : 04:54:32 AM
Hi,

Check that:

win -a Book1;
for (int ii = 1; ii <= wks.maxRows; ii++)
{
if (col(D)[ii]$ == "R" || col(D)[ii]$ == "S") {Wks.deleteRows($(ii)); ii--;}
}

do not use i, it's reserved for origin as I know. Do not forget ";" at the end of statements. For "if" use "==". Best,

Nikolay
electrochemist2017 Posted - 09/27/2017 : 1:39:54 PM
Hey Hideo Fujii,

thanks for the quick reply!

I tried your code and optimized my imported data using the import assistent, which leads to the result in the picture below:



Is it possible to remove the blocks with State = R and State = S in advance, as they are unnecessary resting steps and create extra columns i dont need.

Except from that the code runs smooth :)

[Edit]

I tried a bit around and created a little script:


win -a Book1;
For (I = 1; I <= wks.nRows; I +=1)
{
	If ( Cell(I, col(D))$ = "R")
	{
		Wks.deleteRows(I)
	}
	If ( Cell(I, col(D))$ = "S")
	{
		Wks.deleteRows(I)
	}
};




I donĀ“t know whats wrong with my code, is there maybe something wrong with my syntax?


Best,
electrochemist2017
Hideo Fujii Posted - 09/27/2017 : 10:27:19 AM
Hi electrochemist2017,

You can add a column (say, column D), and set the following formula in the Set Column Value tool:
i==1?1:col(ES)[i]==0?wcol(_ThisColNum)[i-1]+1:wcol(_ThisColNum)[i-1]
You can put the unstack x-function in the Script Panel of the worksheet, then save it as a template:
wunstackcol irng1:=1!1:end irng2:=col(D);
Hope this helps.

--Hideo Fujii
OriginLab

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