Is there any way to directly define new array from a known larger array? For example:

```
a1,a2=[1 2;3 4]
2×2 Matrix{Int64}:
1 2
3 4
a1
1
a2
2
```

This doesn’t give results I need. However, if I set array from a vector of vector, it succeeds:

```
b1,b2=[[1 2],[3 4]]
2-element Vector{Matrix{Int64}}:
[1 2]
[3 4]
b1
1×2 Matrix{Int64}:
1 2
b2
1×2 Matrix{Int64}:
3 4
```

Therefore, is there any method to define array directly from a regular array (matrix, tensor), not nested array?

Looking to capture entire rows or columns?

```
a1, a2 = eachrow([1 2; 3 4])
```

2 Likes

I think it’s no different to change into nested vectors and set variables.

Tbl
November 7, 2022, 8:34pm
#4
But be wary that `eachrow`

returns views to original matrix, that is makes references to the original matrix. If you want new vectors you may just project them by `Vector`

.

2 Likes

What’s the meaning of project? Do you mean `map`

or some other functions?

You could just `collect`

each view to make copies.

1 Like

I understand. Thx for your reply. I think your suggestion is also transfer matrix into vector of vector then set.