Dear All,
I want to know that how can we get such a matrix in Julia:
i.e.
MM1=zeros(Float64,2,2,2)
. ..
many lines of code
. ..
. ..
if (a > 10000)
MM1[3,:,:]=rand(Float64,2,2)
end
in a large loop, the size of matrix MM1 will be changed under user defined IF condition
If I run such a loop in Julia:
ERROR: BoundsError: attempt to access 2×2×2 Array{Float64,3} at index [3, Base.Slice(Base.OneTo(2)), Base.Slice(Base.OneTo(2))]
In Matlab
>> MM1=zeros(2,2,2);
>> MM1(3,:,:)=rand(2,2);
>> MM1
MM1(:,:,1) =
0 0
0 0
0.8032 0.7840
MM1(:,:,2) =
0 0
0 0
0.7292 0.8520
In Octave
octave:2> MM1=zeros(2,2,2);
octave:3> MM1(3,:,:)=rand(2,2);
octave:4> MM1
MM1 =
ans(:,:,1) =
0.00000 0.00000
0.00000 0.00000
0.93338 0.81242
ans(:,:,2) =
0.00000 0.00000
0.00000 0.00000
0.13644 0.78838