Hi, all
In Julia, I find,if I use
A=zeros(20,1);
A can be a array, instead of a vector,but I want it to be a vector and I also want to use function “zeros”, How can I do it?
Thanks a lot!
The number of arguments you pass is the number of dimensions you get. So here you got a two dimensional object since you passed 20 and 1. To get a vector (a one-dimensional object), just pass one argument:
zeros(20)
2 Likes
Thank you very much. It seems not to be the same as MATLAB.
Maybe a quick look at this will help:
https://docs.julialang.org/en/v1/manual/noteworthy-differences/
2 Likes
Thank you!