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
 Forum for Origin C
 wks to mat
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

tinkusch

Germany
94 Posts

Posted - 11/28/2006 :  09:17:04 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5 German
Operating System:XP

Hi folks,
I like to write a labtalk script which converts a worksheet directly into a matrix with the option y-values vary over columns & x-values in first column. I also want to set the range of the worksheet to be converted.
I have found out that the origin -c function OnOpenDMC()
can be used but I do not understand how to preset/select the above options in a labtalk script.
Any help welcome, thanks!

Stefan



Mike Buess

USA
3037 Posts

Posted - 11/28/2006 :  10:09:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Stefan,

Don't know where you found OnOpenDMC() (maybe an import function?) but matrixbase::CopyFromWks copies a specified range from a worksheet to a matrix. If you need to reorder the columns you must do so separately.

Mike Buess
Origin WebRing Member
Go to Top of Page

tinkusch

Germany
94 Posts

Posted - 11/28/2006 :  10:32:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,
I found OnOpenDMC()in the wks.ogs script in the [Wks2Mat] subroutine.
OnOpenDMC()simply opens the Dialog Builder Direct Matrix Conversion dialog box. It uses an other function in the OMat.c source, which probably can do the job:

int convert_wks_to_matrix_direct(string strWksSelection, int iDataFormat, MatrixPage& mpOut)

So far I do not yet understand how to use this function directly!?

Anyway, your suggestion also works ... thanks!
bye

Stefan


Edited by - Tinkusch on 11/28/2006 10:36:45 AM
Go to Top of Page

larry_lan

China
Posts

Posted - 11/29/2006 :  12:12:00 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Stefan:

Just like Mike mentioned, I think you'd better use the matrixbase::CopyFromWks function. Like
 
void test()
{
int c1 = 1, c2 = 4, r1 = 2, r2 = 6;
Worksheet wks("Data1");
Matrix mat("Matrix1");
BOOL bRet = TRUE;
if(mat && wks)
bRet = mat.CopyFromWks(wks, c1, c2, r1, r2);
}


Where c1, c2, r1, r2 is the range specified.

Larry
OriginLab Technical Services
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