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
 Rearrange MatrixLayer elements
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ecerda

6 Posts

Posted - 03/11/2011 :  09:54:55 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): Ver 8.5.0 R1
Operating System: Windows XP

I have a matrixLayer with N matrix objects of size nRow rows x nCols columns (imported from H5 file). I need to rearrange the elements in such a way that all the first elements of the first column of each matrix object are placed in the first column of the first matrixobject, the second elements of the first column in the second column of the first matrixobject and so on. The new multidimensional matrix would have therefore have nRows matrix objects of size N rows x nCols. In other words, I need to rotate the 4D matrix 90 deg arounbd the x axis (columns) such that the matrixobjects and the row indexes exchange: (nrow,ncol,N) -> (N,ncol,nrow).

I tried using 3 nested loops (rows, columns and matrixobject, with that hierachy) in which I define every time the matrixobject I need as a matrix and access the pixel individually and copy it to the new matrix.. this works, but it is too slow for the size of objects I have (200x200 pixels and 70 matrixobjects.)

I would be very grateful for some useful advice.

cpyang

USA
1406 Posts

Posted - 03/13/2011 :  08:08:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Can you post the code? maybe a simplified version so we can see if there is a bottleneck that can be improved. Unless we add internal support for 4D rotation, I don't see a simple way to avoid pixel by pixel moving.

CP

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