Hey guys, I'm a beginner here in Idl and at the moment, I have to create a program and I'm trying to organize the vectors by the index. I mean, the way I was doing it before, I was overlapping the values, so I want to change it. Here is the problem:
The program is about astrophysics and I got describe the behavior of some stars using monte carlo simulation. Here is the way I Declare my vector. The first collumn reffers to time, and the other one is the number of stars.
VarM2=fltarr((nt+nt2),E02)
VarM3=fltarr((nt+nt2),E03)
VarM4=fltarr((nt+nt2),E04)
VarM5=fltarr((nt+nt2),E05)
VarM8=fltarr((nt+nt2),E08)
VarM10=fltarr((nt+nt2),E10)
But now I want them to look like following a sequence, instead going from 0 to E02 ( A number of stars), goes form 0 to X (All number of stars) so I tried this :
For B=0,((nt+nt2)-1)do begin
For I=0,E02-1 do VarM2[B,I]=[B,0]
For I=E02,(E02+E03-1)do VarM3[B,I]=[B,0]
For I=E02+E03,(E02+E03+E04-1) do VarM4[B,I]=[B,0]
For I=E02+E03+E04,(E02+E03+E04+E05-1)do VarM5[B,I]=[B,0]
For I=E02+E03+E04+E05,(E02+E03+E04+E05+E08-1) do VarM8[B,I]=[B,0]
For I=E02+E03+E04+E05+E08,(E02+E03+E04+E05+E08+E10-1) do VarM10[B,I]=[B,0]
Endfor
The idea here is like:
Let's say E02 is 5, and E03 is 10, then VarM2 goes from 0 to 5, then VarM3 goes from 5 to 10
And then I got the error:
Attempt to subscript VARM3 with I is out of range.
Then I tried another way, kind of resuming everything in one vector
I declare this vetor with the size NP (Np here means the total number of stars) and (nt+nt2) reffers to time, just like above
VarM=fltarr((nt+nt2),Np)
VarM=[VarM2,VarM3,VarM4,VarM5,VarM8,VarM10]
Then Idl says :
Unable to concatenate variables because the dimensions do not agree: VARM3.
Does anyone know how to solve this? I would be glad if someone could help me!
|