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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Matrix to Worksheet
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

wallacej

UK
Posts

Posted - 02/02/2005 :  05:31:03 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Mike Buess

USA
3037 Posts

Posted - 02/02/2005 :  08:43:51 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

wallacej

UK
Posts

Posted - 02/02/2005 :  09:11:41 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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?
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 02/02/2005 :  10:28:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

wallacej

UK
Posts

Posted - 02/02/2005 :  11:04:12 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 02/02/2005 :  11:10:39 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

wallacej

UK
Posts

Posted - 02/02/2005 :  11:55:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 02/02/2005 :  12:03:41 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

wallacej

UK
Posts

Posted - 02/02/2005 :  12:22:19 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
cheer man thats spot on!
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000