Arrays in Julia Language

 Way to create an Array in Julia language:


A simple way of creating an array


array18 = fill(18, 4) # values of 18, 4 rows


4-element Array{Int64,1}:
 18
 18
 18
 18




Float64, 2-dimensional,  4-rows, 3-columns

A = Array{Float64,2}(undef, 4,3) 

# Array of floats, 2-dimentional, populate with undefiled data, 4-rows, 3-columns


4×3 Array{Float64,2}:
 2.40692e-314  5.0e-324      1.5e-323
 2.39671e-314  2.40692e-314  1.5e-323
 2.40692e-314  2.40692e-314  1.0e-323 
 2.40692e-314  2.40692e-314  2.38725e-314 


A[1,1] = 123

A




4×3 Array{Float64,2}:
 123.0           5.0e-324      2.5e-323
   2.38296e-314  2.38338e-314  2.5e-323
   2.38338e-314  2.38338e-314  1.0e-323
   2.38338e-314  2.38338e-314  2.64889e-32


Abstract Type Integer

A = Array{Integer}(undef,2,3)


2×3 Array{Integer,2}:
 #undef  #undef  #undef
 #undef  #undef  #undef


Concreate Type Int64

A = Array{Int64}(undef,2,3)

2×3 Array{Int64,2}:
 4826207760  4826207824  4826207888
 4826207792  4826207856  4825801360






Reference:

No comments:

Post a Comment