MATLAB Answers

BOB
0

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

Asked by BOB
on 8 Oct 2018
Latest activity Edited by KSSV
on 8 Oct 2018
Accepted Answer by KSSV
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

  0 Comments

Sign in to comment.

Tags

1 Answer

Answer by KSSV
on 8 Oct 2018
Edited by KSSV
on 8 Oct 2018
 Accepted Answer

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 Comments

Sign in to comment.