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
 Matrix Attach
 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 - 02/26/2013 :  12:32:31 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 9.0.0G PRO and Service Release SR1
Operating System:XP german

TofData is a Martixsheet with 860 matrices (Mat(1) to Mat(860), each containing 1 row. I like to copy these rows one after the other into a new matrix named TARGET.

The following code works for str4 = Mat(1) to str4 = Mat(99),
it aborts when str4 = Mat(100)?

////////////////////////////////////////////
string str4;
Matrix matA;
matA.Attach("[TofData]TofData!"+str4);
matrix mat1(matA);
Matrix matB;
matB.Attach(TARGET);
matrix mat2(matB);

vector v;
int ii;
int row1 = 1;
int row2; // row2 is the row index of matrix TARGET
int rc=matA.GetRow(v, row1-1);

if(!rc)
printf(" Error: GetRow failed.\n");
else
{
printf(" Vector copied from row %d\n", row1);
}
int rd = matB.SetRow(v, row2-1);
//////////////////////////////////////////////////////////

error mressage: index out of range

Is there any reason for this error?
Advice for a workaround needed....

Thanks very much
Stefan

Penn

China
644 Posts

Posted - 02/26/2013 :  9:35:32 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Stefan,

This is a bug, sorry for that. You can use another way to get matrix object, such as

MatrixLayer ml("[TofData]TofData!");  // get the matrix layer
MatrixObject mo = ml.MatrixObjects(100);  // get the 101st matrix object
Matrix& matA = mo.GetDataObject();  // please make sure the data type in matrix object is double type
// or use matrixbase for any data type
// matrixbase& matA = mo.GetDataObject();
matrix mat1(matA);


Penn
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