Call first row from zero-padded matrix - only call the non-zero values

1 次查看(过去 30 天)
Hi folks,
I have a zero-padded matrix. I'm aware A(:,1) would call the first row of matrix A, but I want to only call the values in each row with non-zero values.
Thanks

采纳的回答

KSSV
KSSV 2018-10-8
编辑:KSSV 2018-10-8
Note that A(:,1), calls the first column..not the first row. If you want first row, use A(1,:)
To get only non-zero values use:
r1 = A(1,A(1,:)~=0)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by