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
 Matrix to Worksheet

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
wallacej Posted - 02/02/2005 : 05:31:03 AM
Origin Version (7.5):
Operating System:Windows 2000


I have a worksheet which amongst many columns has a length column and a circularity column. I have a matrix which bins the length and circularity values , thus providing frequency counts for length by circularity.

I would like to take the frequency values and place them in a column on a worksheet, any ideas on how to do this?

Many thanks
8   L A T E S T    R E P L I E S    (Newest First)
wallacej Posted - 02/02/2005 : 12:22:19 PM
cheer man thats spot on!
Mike Buess Posted - 02/02/2005 : 12:03:41 PM
The matrix is really just one long dataset. If you already have a worksheet (Data1) containing the x,y values in columns 1 and 2 then this will work... (Assumes matrix name is Matrix1)

win -a Data1; // activate Data1
wo -i 2; // insert column after col 2
col(3)=Matrix1; // copy entire matrix to column 3

The numbers in col 3 will be ordered like they are with the mat.m2xyz() method.

Mike Buess
Origin WebRing Member
wallacej Posted - 02/02/2005 : 11:55:50 AM
Thanks a lot Mike, you've really helped me out here

That has solved my problem. I now only wish to copy over the Z value from the matrix as the x and y (co-ordinate mapping) values lose accuracy when the matrix is created (from 5d.p. to 1d.p/). I am simply going to create the x,y,z worksheet from the matrix and then copy over x and y with the original values. If you do know an easier way then let me know.

Thanks Again
Mike Buess Posted - 02/02/2005 : 11:10:39 AM
Oh, you can convert matrix directly to XYZ wks. The X and Y values come from the matrix' coordinate mapping. (Matrix->Set Dimensions->Coordinates)

mat.matname$=%H;
win -t D;
wo -i 2; // add column
wks.col3.type=6; // set as Z
mat.wksname$=%H;
mat.m2xyz();

...You need to add the Z column to wks before converting. (lines 3 and 4)

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 02/02/2005 11:27:58 AM
wallacej Posted - 02/02/2005 : 11:04:12 AM
I mean to take each individual cell value from the matrix and place them into a single worksheet column.
The matrix was constructed using 2D binning. I'm thinking of it as like a graph. The x and y values are column, row labels for the matrix and each cell value (Z) is the frequency of the occurence of the x,y combination.

I'm new to Origin and didn't write the original script so I may be wrong and confused

Thanks
Mike Buess Posted - 02/02/2005 : 10:28:35 AM
Assuming your X and Y values are already in the first two columns of Data1 and the Z values (converted from matrix) are in the Nth column of Data2...

win -a Data1; // activate Data1
wo -i 2; // insert column after col 2
col(3)=%(Data2,N); // copy Nth column from Data2
wks.col1.type=4; // set col 1 as X
wks.col2.type=1; // set col 2 as Y
wks.col3.type=6; // set col 3 as Z

Mike Buess
Origin WebRing Member
wallacej Posted - 02/02/2005 : 09:11:41 AM
Thanks, that works. I now have my matrix as a worksheet. Do you know if it is now possible to now take each matrix (now worksheet) value and assign it to a Z column in a worksheet, corresponding to it's X, Y value?
Mike Buess Posted - 02/02/2005 : 08:43:51 AM
Easiest way using LabTalk is to convert matrix to wks. With matrix active...

mat.matname$=%H;
win -t D; // create wks
mat.wksname$=%H;
mat.m2w(); // convert matrix to wks

Mike Buess
Origin WebRing Member

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