How to access elements of 1-D array through some other 1-D array?
How to access elements of 1-D array through some other 1-D array? I am very new to Julia, even new to programming. Therefore, please excuse me for simple doubts. consider the below Matlab Example: A=[10; 20; 30; 40; 50]; B=[1; 3; 5]; The result of A(B)=0 in the matlab shall be [0.0 20 0.0 40 0.0] . A(B)=0 [0.0 20 0.0 40 0.0] How do I achieve the same in Julia for 1-D array?? I have a variable A and B : A B julia> A 5×1 ArrayInt64,2: 10 20 30 40 50 julia> B 2-element ArrayInt64,1: 1 3 5 when I execute this A[[B]] A[[B]] ERROR: ArgumentError: invalid index: ArrayInt64,1[[1, 2]] ERROR: ArgumentError: invalid index: ArrayInt64,1[[1, 2]] HOWEVER, this statement provides this result: julia> A[[1, 3 ,5]] 3-element ArrayInt64,1: 5 3 1 Please guide me. I know that Julia has the flat array, but how to access them through any other flat array. Hi Nit_GUP, it is not really clear to me what you actually want do do. Regarding your error, it is just the difference b