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
 Forum for Origin C
 Matrix Attach

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
tinkusch Posted - 02/26/2013 : 12:32:31 PM
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

1   L A T E S T    R E P L I E S    (Newest First)
Penn Posted - 02/26/2013 : 9:35:32 PM
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

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