I have a 4: 3 matrix and I would like to take only 2: 3.
Is it possible to delimit using the DelimitedFiles command? How should I use it?
Q = convert(Matrix, ACT[2:3])#I would like to omit the 2:3
I have a 4: 3 matrix and I would like to take only 2: 3.
Is it possible to delimit using the DelimitedFiles command? How should I use it?
Q = convert(Matrix, ACT[2:3])#I would like to omit the 2:3
Suppose you have the following Matrix:
julia> a = collect(reshape(1:12,(4,3)))
4×3 Array{Int64,2}:
1 5 9
2 6 10
3 7 11
4 8 12
You can select a subarray in two ways - either making a copy of the desired part or creating a view.
Making a copy (a new object is created and Array's data is copied:
julia> a[1:2,:]
2×3 Array{Int64,2}:
1 5 9
2 6 10
Creating a view. This is in many scenarios much faster because the data is not copied:
julia> view(a, 1:2, :)
2×3 view(::Array{Int64,2}, 1:2, :) with eltype Int64:
1 5 9
2 6 10
For creating the view you can also use a macro - in this case your code will be more similar to the one that copies the data:
julia> @view a[1:2,:]
2×3 view(::Array{Int64,2}, 1:2, :) with eltype Int64:
1 5 9
2 6 10
Each of those views can be shown using the command display and this is the standard way to handle showing them.
However if you want to use DelmitedFiles you can, for example:
julia> using DelimitedFiles;writedlm(stdout, @view a[1:2,:])
1 5 9
2 6 10