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
 naming of matrix copies
 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 - 01/18/2005 :  2:51:05 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin):7.0 SR4
Operating System:XP

Hi,
a good way to copy a big matrix with OriginC seems to be the following:

void matrix_copy()
{
MatrixLayer mat;
MatrixLayer matSource("mymatrix");
int nOption = CREATE_VISIBLE_SAME;
BOOL bRet = mat.CreateCopy(matSource, nOption);
}

After each execution a new copy of "mymatrix" is generated in an new window, having a new name (mymatrixN, where N is an integer increment number).

Here's my problem:
Is it possible to change the code, so that the copy is always generated in an already existing window without channging its name?

Thanks for any help

Stefan

tinkusch

Germany
94 Posts

Posted - 01/19/2005 :  3:11:28 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,
I found the following solution:

void matrix_copy()
{
MatrixLayer matdelete("Results");
matdelete.Destroy();
//deletes matrix "Results" first if there is any!
MatrixLayer mat("newmat");
MatrixLayer matSource("Matrix1");
int nOption = CREATE_VISIBLE_SAME;
BOOL bRet = mat.CreateCopy(matSource, nOption);
mat.GetPage().Rename("Results");
//renames matrix "newmat" to "Results".
}

bye

Stefan




Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 01/19/2005 :  3:57:46 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Stefan,

Here is an alternative method that doesn't involve destroying and recreating the Results matrix...

void matrix_copy(string sMatName)
{
Matrix m1(sMatName);
if( !m1 )
return;
uint nCols = m1.GetNumCols();
uint nRows = m1.GetNumRows();
MatrixPage mp("Results");
if( !mp )
{
mp.Create("Origin.otm");
mp.Rename("Results");
}
Matrix m2("Results");
m2.SetSize(nRows,nCols);
m2 = m1;
}


Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 01/19/2005 3:59:24 PM
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