comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » IDL2MATLAB
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL2MATLAB [message #29538 is a reply to message #29482] Wed, 27 February 2002 14:43 Go to previous messageGo to previous message
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
Nigel Wade wrote:
> Liam E. Gumley wrote:
>
>> Ethan wrote:
>>>
>>
>>
>> A complicating factor is that in IDL, arrays are stored in column-major
>> order (the same as FORTRAN), while in Matlab, arrays are stored in
>> row-major order (the same as C).
>
> Substitute IDL for MATLAB. In IDL they are the same as in C. I can never
> remember which is column-major or row-major, but I know that using MATLAB
> multi-dimension matrices in C mex files is a real pain because of the array
> indexing difference.

I'll stick by my original comments, which referred to *arrays* only (not
matrices). In IDL and FORTRAN, an array with dimensions [m cols, n rows]
is stored contiguously in memory as

(col 1, row 1), (col 2, row 1), (col 3, row 1), ... (col m, row 1),
(col 1, row 2), (col 2, row 2), (col 3, row 2), ... (col m, row 2),
(col 1, row 3), (col 2, row 3), (col 3, row 3), ... (col m, row 3),
.
.
.
(col 1, row n), (col 2, row n), (col 3, row n), ... (col m, row n)

The term "column-major" is used because the column index varies the
fastest when accessing contiguous elements of a multi-dimensional array
in memory.

Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Odd behavior of Device, cursor_image
Next Topic: array of structure changed from 5.4 to 5.5?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 16:09:30 PDT 2025

Total time taken to generate the page: 0.00438 seconds