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
 convert worksheet to matrix with regular format

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
vistec Posted - 03/09/2006 : 03:32:37 AM
Origin Version (Select Help-->About Origin): 7.5 SR 4
Operating System: Win XP Service Pack 2

Hello All,

I want to convert a worksheet to a matrix using the regular XYZ to matrix format. Converting the matrix in Origin (edit/convert to matrix / regular xyz ) works well.
Now I want to do this by using Labtalk.
I used the following Labtalk code from the Labtalk help:

mat.wksname$ = %H;
win -T M;
mat.matname$ = %H;
mat.xcol = 1;
mat.ycol = 2;
mat.zcol = 3;

//Convert the XYZ data to a matrix

mat.xyz2m();

The problem is that only an empty Matrixsheet is created.
The columns in the worksheet are specified correctly as x,y and z.
So I can 't find the mistake. Perhaps there is a better opportunity to solve the problem in Origin C?

Thanks

vistec
4   L A T E S T    R E P L I E S    (Newest First)
vistec Posted - 03/10/2006 : 03:30:27 AM
thanks Mike
Mike Buess Posted - 03/09/2006 : 10:54:56 AM
I think LabTalk's mat.xyz2m() method is equivalent to setting the bCheckData argument to false in convert_regular_xyz_to_matrix(). In other works, your Origin C function might also fail if you use this...

convert_regular_xyz_to_matrix(vecX, vecY, vecZ, matData,
dXmin, dXmax, dYmin, dYmax,false);

Mike Buess
Origin WebRing Member
vistec Posted - 03/09/2006 : 10:20:39 AM
Thanks Mike for your help.

I changed my code into the following.
Now I call an origin c function:

run_convert_regular_xyz_to_matrix();

from the Origin C help, in Labtalk.

Code:

void run_convert_regular_xyz_to_matrix()
{
Dataset dsX("stopugo_PositionX"), dsY("stopugo_PositionY"),
dsZ ("stopugo_mRX");

vector vecX(dsX), vecY(dsY), vecZ(dsZ);

MatrixLayer ml;
ml.Create();
Matrix matData(ml);

double dXmax, dXmin;
vecX.GetMinMax(dXmin, dXmax); //Get the maximum and minimum
values of X
double dYmax, dYmin;
vecY.GetMinMax(dYmin, dYmax); //Get the maximum and minimum
values of Y
convert_regular_xyz_to_matrix(vecX, vecY, vecZ, matData,
dXmin, dXmax, dYmin, dYmax);
}

The code works well. Nevertheless in my opinion this code and the
Labtalk code should cause the same result. Maybe there is a stronger difference between a Labtalk command and its corresponding origin c code than it seems to for me be at first glance?

Edited by - vistec on 03/09/2006 10:21:18 AM

Edited by - vistec on 03/09/2006 10:23:03 AM
Mike Buess Posted - 03/09/2006 : 08:46:23 AM
Hi vistec,

Your script works perfectly for me with a regular XYZ wks regardless of the actual column designations. Possibly your wks is not as regular as you think. If I make a slight change to one value in the X or Y column the script fails even though the corresponding menu command still works. The menu command probably tests and smooths the data prior to conversion. You can find out exactly what the menu command does by pressing Ctrl+Shift while you select the menu item.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 03/09/2006 08:49:44 AM

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