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
 How to range a multi-column data to one column?

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
hearme Posted - 11/19/2003 : 09:21:50 AM
Some XRD data are in this form:
a b c d e
f g h i j
k l m n o
... ...

In order to redraw the XRD pattern in origin, I need to change these data to the following format,

a
b
c
d
e
f
g
h
i
j
...
Could you please tell me how to do this in origin?
Thanks

3   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 11/19/2003 : 11:25:37 AM
In case you are not using Origin 7 or 7.5 this can also be done in LabTalk. Start with the original ncols by nrows worksheet active...

mat.wksName$=%H;
ncols=wks.ncols; // find number of columns
get col(1) -e nrows; // find number of rows
win -t M; // open matrix window
mat.matName$=%H;
matrix -ps D ncols nrows; // set columns and rows
mat.w2m(); // convert wks to matrix
matrix -ps D ncols*nrows 1; // change matrix to single row
matrix -t; // transpose (change to single column)
win -t D; // open new wks
mat.wksName$=%H;
mat.m2w(); // convert matrix to wks
%M=mat.matName$;
win -c %M; // close matrix window
del %M; // delete its data separately

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 11/19/2003 11:27:53 AM
Laurie Posted - 11/19/2003 : 11:04:25 AM
You can also write an Origin C function to do this, such as the following:

void hearme_transpose(string strWksName, string strWksName2)
{
Worksheet wks(strWksName);
Dataset ds(strWksName,0);
Dataset ds2(strWksName2,0);
ds2.SetSize(ds.GetSize()*wks.GetNumCols());
int count=0;
for(int i=0;i<ds.GetSize();i++)
{
for(int j=0;j<wks.GetNumCols();j++)
{
ds2[count]=wks.Cell(i,j);
count++;
}
}

}

The function takes 2 arguments: the name of the worksheet that contains the data and the name of the worksheet that will hold the new column of data.

If you need help on how to use this function from the Script Window, once compiled, let me know. You can email me at tech@originlab.com.

OriginLab Technical Support
Mike Buess Posted - 11/19/2003 : 10:44:34 AM
Here is an easy method. It assumes your worksheet contains ncols columns and nrows rows.

1> With worksheet showing select Edit->Convert to Matrix->Direct
2> Select Matrix->Set Dimensions
3> Set Columns=ncols*nrows and Rows=1. OK. (Creates single row)
4> Matrix->Transpose (Converts to single column)
5> Edit->Convert to Worksheet->Direct

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 11/19/2003 10:44:48 AM

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