How to delete a row of matrix in julia

前端 未结 3 1938
抹茶落季
抹茶落季 2021-01-04 04:47

In matlab, deleting the 2nd row of matrix A is

A(2,:) = [];

How to delete a row of matrix in julia? I tried to use A(2,:

3条回答
  •  佛祖请我去吃肉
    2021-01-04 05:36

    You can't delete a row from a matrix – the fact that Matlab has easy syntax for this is a bit of a trap because the actual way you have to delete a row is to create a copy without the row so we decided to make that explicit and thereby have more transparent performance characteristics. You can change the size of 1-dimensional arrays, e.g. doing push!(v,x) and pop!(v).

提交回复
热议问题