Re: matrices with different size [message #42149] |
Thu, 13 January 2005 09:52 |
K. Bowman
Messages: 330 Registered: May 2000
|
Senior Member |
|
|
In article <3374f20e.0501130821.41623a00@posting.google.com>,
ikverveelmijdood@hotmail.com (V.S.) wrote:
> Hi,
> my problem is the following: I have a dataset with a strong sinusoidal
> component. However, its period and height are not constant. What I
> exactly want is to split-up the data in different parts, and put them
> into a matrix. Is this possible in IDL (and how?) to generate a
> matrix, filled with vectors that have a different length? I know that
> in Matlab "cell arrays" can be used.
> Best regards,
> Veerle
There are many options. You could:
1) use an array with one dimension equal to the size of the longest
vector that you need. Initialize it with NaNs. This would probably be
easiest to program but potentially inefficient of memory use.
2) use a 1-D array large enough to store all of the values plus a
table of indices, like REVERSE_INDICES does for HISTOGRAM. A little
harder to program but efficient of memory use.
3) use a dynamical data structure like a linked list (using
pointers). I think someone has written a library for making linked
lists.
4) possibly(?) use the sparse-array capabilities of the LAPACK
routines.
Ken Bowman
|
|
|