Hey guys, is it possible to delete a row or column from a multi-dimensional array (say a matrix) “in-place”? Somewhat similar to what `deleteat!`

does for vectors. I guess the answer is no but I thought I’d ask (and test our new bridging system ). Thanks in advance. (second attempt :D)

No, that is not possible.

Perhaps a matrix isn’t the correct structure? This is very easy to do in DataFrames

```
julia> a = [1 2; 3 4]
2×2 Array{Int64,2}:
1 2
3 4
julia> reshape(resize!(vec(a), length(a) - size(a, 1)), size(a, 1), :)
2×1 Array{Int64,2}:
1
3
```

It is possible, as was mentioned on slack.

This also generalizes:

Simeon Schaub:

Yes, you can just replace`size(a, 1)`

with`size(a)[2:end]...`

to always resize the last dimension of a higher-dimensional array

crstnbr:

That’s something. But it only works for the last dimension. What about the generic case, i.e dropping, say, the second column of a 1x2x3x4 sized array?

Simeon Schaub:

You should be able to use a similar approach there as well. You just need to convert whatever you want to delete to linear indices and then you can use`deleteat!`

after reshaping to a vector with`vec`

The answers don’t show up here because the bridge bot is not that smart yet.

You can take a view.

For those finding this post via Discourse - it is only bridged Slack → Discourse, not the other way around…