Technical discussion about Matlab and issues related to Digital Signal Processing.
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 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
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 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 __________________________________________________
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