Technical discussion about Matlab and issues related to Digital Signal Processing.
Is this thread worth a thumbs up?
I would like to remove all of the "zeros" from a data array. For Example I would like to change: A=[1 3 7 0 4 6 9 6] to A=[1 3 7 4 6 9 6] I have tried the following: for i=1:1:length(A) if A(i)==0 A(i)=[]; end end 

use the nonzeros function ...  Original Message  From: "Nick13WV" <> To: <> Sent: Tuesday, April 30, 2002 6:03 PM Subject: [matlab] Removing Unwanted Data Points > I would like to remove all of the "zeros" from a data array. > > For Example > I would like to change: A=[1 3 7 0 4 6 9 6] > to A=[1 3 7 4 6 9 6] > > I have tried the following: > for i=1:1:length(A) > if A(i)==0 > A(i)=[]; > end > end > > > _____________________________________ > /groups.php3 
This would do the trick A = A(A ~= 0); Good luck  Srivat  Original Message  From: Nick13WV To: Sent: Tuesday, April 30, 2002 6:03 PM Subject: [matlab] Removing Unwanted Data Points I would like to remove all of the "zeros" from a data array. For Example I would like to change: A=[1 3 7 0 4 6 9 6] to A=[1 3 7 4 6 9 6] I have tried the following: for i=1:1:length(A) if A(i)==0 A(i)=[]; end end Yahoo! Groups Sponsor ADVERTISEMENT _____________________________________ /groups.php3 Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 