Reputation: 743
Is there any possibility in Julia to have a matrix including an empty array as its element, for example as follow:
Alpha=zeros([],3,3)
The first element of Alpha
is an array whose dimension isn't determined. But it gets error.
Would you please help me that how can I attain the matrix.
Upvotes: 0
Views: 55
Reputation: 12918
I'm just putting this here for posterity. Based on the comments, it sounds like you are either looking for an array of uninitialized arrays of type Int
(Bogumil's comment):
alpha = [Int[] for i in 1:total_i, j in 1:total_j] # etc. for however many dimensions
or you are looking for an n-dimensional array of type Int
(Oscar's comment). For instance, a 3-dimensional array:
alpha = array{Int, 3}(undef, total_i, total_j, total_k)
Just wanted to collate the comments section into an answer in case somebody comes looking and doesn't notice the comments.
Upvotes: 1