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 cells access by Row and Col indexes
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Alex-qwerty

Russia
Posts

Posted - 06/03/2008 :  03:35:53 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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!

Iris_Bai

China
Posts

Posted - 06/05/2008 :  11:41:31 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
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