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 cells access by Row and Col indexes

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
Alex-qwerty Posted - 06/03/2008 : 03:35:53 AM
Origin Version PriginPro 6 SR1 v8.0773
Operating System: WinXP SP2 rus

Hi All!
Is there a method to set/get values of matrix by row and column indexes?
I found only method GetCellValue().
But it uses X and Y values.
So, I have to use expression:
MyVar=MyMatrix.GetCellValue(MyMatrix.GetXValue(i),MyMatrix.GetYValue(j));
but it seems not effective.
Is there more clear and fast way?
Thanks!
1   L A T E S T    R E P L I E S    (Newest First)
Iris_Bai Posted - 06/05/2008 : 11:41:31 PM
Hi,

Matrix derived from matrix and matrix derived from matrixbase, so can access Matrix object by mat[row][col], for example:


void MatrixSample()
{
MatrixLayer matLayer = Project.ActiveLayer();
if( matLayer )
{
Matrix matData(matLayer);
for(int nRow = 0; nRow < matData.GetNumRows(); nRow++)
{
for(int nCol = 0; nCol < matData.GetNumCols(); nCol++)
{
printf("%f\t", matData[nRow][nCol]);
}
printf("\n");
}
}
}




Iris

Edited by - iris_bai on 06/05/2008 11:43:40 PM

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