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
 Table-Rearrangement

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
chessboard12 Posted - 01/25/2019 : 10:43:27 AM
Origin Ver. 2018G (64Bit)
Operating System: Windows 10

Hello everyone,

it`s me with the same question again: i try to split a huge table.
yuki wu gave me some help, but the division of the table was at the wrong positions.
Nevertheless thank you for this response! :)

So, to better depict the problem here`s a picture of the current table:



The marked "H"s in the first column indicate a new measurement series. These series are all listed below themselves.
To better compare the data all measurement series should be arranged next to each other and in one worksheet.

After rearrangement it should look like this:




The measurement series are differently long, so splitting every 100 rows will not work. It´s only the letter "H" which indicates the start of a new measurement series.

Further more it would be helpful to delete columns "A" and "D" of the current table and illustrate column B (date) only once.


Thanks in advance, yuki wu, if you could give me some additional help for that! And of course thanks to everyone else! :)

Ben

3   L A T E S T    R E P L I E S    (Newest First)
yuki_wu Posted - 01/28/2019 : 9:16:10 PM
Hi,

I didn't create the grouped index column by manual, it was created by wks.addCol() and later fill the value by script I showed you. This image may help you understand it:


https://www.originlab.com/doc/LabTalk/ref/Wks-obj

Regards,
Yuki

OriginLab
chessboard12 Posted - 01/28/2019 : 07:43:26 AM
Hi yuki wu,

wks.addCol("Group") does not work, so that there`s no 6th column which displays the group index.

In your examples this "group index column" is already present in the beginning picture. How`s that?

Regards,
Ben
yuki_wu Posted - 01/27/2019 : 9:52:30 PM

Hi Ben,

If you don’t want to split the data into several worksheets, you could unstack columns instead. I added comments in the script I told you before, I think it will be easier to understand now:

wks.addCol("Group"); //Add a new column to store the group index
range rA = col(1);
int nRows = rA.GetSize(); //Get the rows number of column(1)
range rG = col($(wks.nCols));
int nGroup = 0;
string str$ = "H*"; //If the indicator is exactly "H", you could modify this line to string str$ = "H";
for(int ii = 1; ii <= nRows; ii++) //Loop over column(1)
{
	if(Match(rA[$(ii)]$, str$))//To check if col(1)[ii] starts with the character "H"
	{
		nGroup++;
	}
	rG[$(ii)] = nGroup; //Fill the group index in col("Group")
}
//wsplit -r 2 mode:=ref ref:=col($(wks.nCols)); //Split the grouped data into several worksheet
//Modify irng1 according to your source data
wunstackcol irng1:=(2:5) irng2:=6; //Unstack the grouped data, more info: https://www.originlab.com/doc/X-Function/ref/wunstackcol







Regards,
Yuki

OriginLab

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