How to shift zero in the last column of a matrix

前端 未结 7 1497
我在风中等你
我在风中等你 2020-12-11 10:58

I have one matrix like below-

A=[1 1 1 1 1;
   0 1 1 1 2;
   0 0 1 1 3]

But I want to place all the 0 at the end of the row, s

7条回答
  •  长情又很酷
    2020-12-11 11:04

    I've also asked this question and got a super elegant answer (non of above answers is same) here: Optimize deleting matrix leading zeros in MATLAB

提交回复
热议问题