Sign in

username:

password:



Not a member?

Search matlab



Search tips

Subscribe to matlab



matlab by Keywords

Atanh | Autocorrelation | Bandpass Filter | C++ | Conv | Database | Deconv | Excel | FFT | Filter | Filtering | FIR | Fourier Transfrom | FSK | Gaussian Noise | Haykin | IFFT | Image | Java | LFSR | LMS | LPC | MEX | OFDM | QPSK | Radix | Random | Sampling | Segmentation | Simulink | Visual Basic | Waveform | Wavelet

Sponsor

NEW! TMS320C6474: 3x the performance. 1/3 the cost. Three 1 GHz cores on 1 chip.

Discussion Groups

Discussion Groups | Matlab DSP | Simulink/C6713 project

Technical discussion about Matlab and issues related to Digital Signal Processing.

  

Post a new Thread

Count the number of zeros - Shailesh Khanolkar - Apr 13 7:45:39 2006



Hi !
I have a 100 X 181 matrix and i want to count the
number of zeros in each column of the matrix. i.e I
want to generate a 1 X 181 matrix where each column
contains the number of 0's in the 100 X 181 matrix.
What is the easiest way of doing the above task?

Shailesh



(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )

Re: Count the number of zeros - Amit Pathania - Apr 13 14:07:41 2006

you can use the 'find' function ... 
   
  !!!!pseudo-code
   
  a(1,n) = length(find(:,n ==0));
  where 'n' goes from 1:181 .. also there might be a way to avoid the 'for' loop. I have not
checked though if find will work on individual columns .. but I m pretty sure it will

Shailesh Khanolkar <s...@yahoo.com> wrote:
  Hi !
I have a 100 X 181 matrix and i want to count the
number of zeros in each column of the matrix. i.e I
want to generate a 1 X 181 matrix where each column
contains the number of 0's in the 100 X 181 matrix.
What is the easiest way of doing the above task?

Shailesh



(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )

Re: Count the number of zeros - Sindhu John - Apr 14 6:57:31 2006

Shailesh,
   Try X=sum(Your_matrix == 0). This should give you a row vector having 
number of zeros in each column.

Sindy
On Wed, 12 Apr 2006, Shailesh Khanolkar wrote:

> Hi !
> I have a 100 X 181 matrix and i want to count the
> number of zeros in each column of the matrix. i.e I
> want to generate a 1 X 181 matrix where each column
> contains the number of 0's in the 100 X 181 matrix.
> What is the easiest way of doing the above task?
>
> Shailesh
>



(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )

Re: Count the number of zeros - Amit - Apr 14 6:57:41 2006

You can use  
zero_vec = sum((x == 0));
to get your result in 1x181 format. This avoids the
for loop.
Amit

--- Amit Pathania <a...@yahoo.com> wrote:

> you can use the 'find' function ... 
>    
>   !!!!pseudo-code
>    
>   a(1,n) = length(find(:,n ==0));
>   where 'n' goes from 1:181 .. also there might be a
> way to avoid the 'for' loop. I have not checked
> though if find will work on individual columns ..
> but I m pretty sure it will
> 
> Shailesh Khanolkar <s...@yahoo.com> wrote:
>   Hi !
> I have a 100 X 181 matrix and i want to count the
> number of zeros in each column of the matrix. i.e I
> want to generate a 1 X 181 matrix where each column
> contains the number of 0's in the 100 X 181 matrix.
> What is the easiest way of doing the above task?
> 
> Shailesh
__________________________________________________



(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )

Simulink/C6713 project - heidar mhr - Apr 25 12:53:53 2006

Hello group,
   
  I want to try connecting the C6713 board to SIMULINK. I have all the necessary blocksets and
I successfully tried filtering a real-time input through the board and with SIMULINK. Now I
request if any one has a simple       
  pre-made project that uses SIMULINK and C6713 please send it to me to: a...@hartford.edu so I
can download and try it. The project could be in any subject (dsp-related). I would really
appreciate it.
   
  Thank you,
  Haidar



(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )