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
 Splitting rows into multiple columns

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
thentangler Posted - 08/05/2010 : 02:46:46 AM
Origin Ver. 8.1 and Service Release 3 Operating System: Win 7

Hi,
Im having problem with this labtalk script.
I have a whole list of data in one collumn where measurements have been done in steps of 201 points. I want to separate this long column of 1005 rows into 5 columns of 201 rows of data. (1005/201=5)
I wrote a Labtalk script, but for some reason it gives me a

LabTalk expression error: 5
Error: GETSIZE()

This is the script:
r=1;
q=1;
for (t=1; t<=wks.maxrows/201; t++)
{
for (i=r; i<=201; i++)
{
cell(q,t+2)=cell(i,2)
q=q+1;
}
r=i+1;
q=1;
}

For some reason this error only comes when I put q=q+1
Please help,
Thank You
10   L A T E S T    R E P L I E S    (Newest First)
thentangler Posted - 11/07/2010 : 8:09:35 PM
Thank You so much.
That did the trick.
Thanks
cpyang Posted - 09/13/2010 : 07:51:33 AM
for now, you have to use substitution notation

rr= col(1)[$(a):$(b)];


CP
thentangler Posted - 09/12/2010 : 10:52:11 PM
Hi,
When I try range rr= col(1)[1:30];
I cant seem to put variables in.
For example I cant store 1 in a and 30 in b and use the syntax:
range rr= col(1)[a:b]
It is just giving me the whole range of col(1)
What identifier should I use please?
DataConv Posted - 08/16/2010 : 05:17:12 AM
There is also another way to handle this:
Convert your row of the worksheet in a numeric matrix, redimension it and convert it back (if needed) to a worksheet. Just 3 lines of code in the script...
thentangler Posted - 08/15/2010 : 12:02:52 PM
Oh cool
Thats exactly what I was looking for.
Thanks a million.
:)
larry_lan Posted - 08/10/2010 : 06:35:58 AM
It's not a loop issue. In Origin, you'd better use range variables to specify sub-range of dataset:

range rr = col(a)[1:30];
col(b)=rr;


Thanks
Larry
thentangler Posted - 08/10/2010 : 12:18:23 AM
Hi Larry,
Thank you for the script. But it still uses an elaborate for loop.
Is there a way like we do in MATLAB where we use B=A(1:30)
Where Matrix A is has more than 30 rows?

Thank You
larry_lan Posted - 08/09/2010 : 09:50:04 AM
Hi:

You can specify the From and To rows in Set Column Value dialog. And you can also use Range in your script. For example


newbook;
wks.ncols = 4;
col(1) = data(1, 121);
range r1 = !col(1);
int nrow = 50;
for(ii = 2; ii <= 4; ii++)
{
	range r2 = r1[$((ii-2)*nrow+1):$((ii-1)*nrow)];
	wcol(ii) = r2;
}

Thanks
Larry
thentangler Posted - 08/09/2010 : 12:33:02 AM
Hi,
Thank you so much... It worked. That was so silly of me.

But is there a way I can assign a range of rows from one column to another column instead of using a for loop?
Like if I want to assign the first 30 rows of col(A) to col(B)?
Thank You

Rudy
cpyang Posted - 08/05/2010 : 07:53:19 AM
missing ; after cell(q,t+2)=cell(i,2)


CP

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