Reply by Srivathsan Krishnamachari May 1, 20022002-05-01
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 _____________________________________
Note: If you do a simple "reply" with your email client, only the author of
this message will receive your answer. You need to do a "reply all" if you want
your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:

To Post:

To Leave:

Archives: http://www.yahoogroups.com/group/matlab

More DSP-Related Groups: http://www.dsprelated.com/groups.php3


Reply by Rizwan Ahmed May 1, 20022002-05-01
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 >
>
> _____________________________________
> Note: If you do a simple "reply" with your email client, only the author
of this message will receive your answer. You need to do a "reply all" if
you want your answer to be distributed to the entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join:
>
> To Post:
>
> To Leave:
>
> Archives: http://www.yahoogroups.com/group/matlab
>
> More DSP-Related Groups: http://www.dsprelated.com/groups.php3
>
> ">http://docs.yahoo.com/info/terms/ >




Reply by Nick13WV April 30, 20022002-04-30
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