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

Home » Public Forums » archive » matrices with different size
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: Matrices [message #82887 is a reply to message #42151] Mon, 21 January 2013 06:48 Go to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Monday, January 21, 2013 3:32:42 PM UTC+1, fd_...@mail.com wrote:
> Hello!
>
>
>
> I just start using IDL and I have one simple question about matrices.
>
>
>
> I want to create an N by 4 (Nx4)matrix and an N by 1 (Nx1)matrix with my own elements. Does anyone know how to do it?

Hi,
this is not normally the way people make things, however here is a command line option:
MyFiveByFourMatrix = [[0,4,8,12,16],[1,5,9,13,17],[2,6,10,14,18],[3,7,11,15,19]]
To check, just type:
help, MyFiveByFourMatrix

But generally you would like to use something like:
N=10
MyFiveByFourMatrix = Make_array(N,4,/INTEGER) ; Makes a 10x4 matrix

If you want to do a Nx1 matrix, use either:
N_by_One_Matrix = [0,1,2,3,4,5]
or
N_by_One_Matrix = Make_array(N,1,/INTEGER)

The above actually generates an array of N elements. If you really want a Nx1, then you should do the following:
N_by_One_Matrix = reform([0,1,2,3,4,5], 6,1)
or
N_by_One_Matrix = reform(Make_array(N,/INTEGER),N,1)

Hope it helps.

Cheers,
Helder
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: LSODE status=-1
Next Topic: Imposing inverse fft to be real

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

Current Time: Sun Oct 12 09:24:37 PDT 2025

Total time taken to generate the page: 1.04133 seconds