How to delete a row of matrix in julia

前端 未结 3 1937
抹茶落季
抹茶落季 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:26

    I don't know the first thing about Julia, but I think it uses square brackets ([]) for indexing, so you should try the following:

    A[2, :] = []
    

    I don't have a Julia interpreter at hand to test that, but if that also fails, surely the following should work:

    A = A[[1, 3:end], :]
    

    which simply uses the reverse strategy of selecting the rows that you want to keep.

提交回复
热议问题