Counting number of zeros in an array

N

Nish

Hi all,
i want to find a mat lab algorithm in order to count number of
zeros in any given matrix

for eg

Given Matrix A:

1 0 1 1
0 0 1 1
2 2 3 3
2 2 4 0


the required code should give me the no of zeros as 4

Please post your views on the topic.

thanks

Nishant

(e-mail address removed)
 
O

Oliver Wong

Nish said:
Hi all,
i want to find a mat lab algorithm in order to count number of
zeros in any given matrix

for eg

Given Matrix A:

1 0 1 1
0 0 1 1
2 2 3 3
2 2 4 0


the required code should give me the no of zeros as 4

Please post your views on the topic.

My view is that Matlab isn't Java, and so this sounds like it's off
topic here.

- Oliver
 
R

Rhino

Nish said:
Hi all,
i want to find a mat lab algorithm in order to count number of
zeros in any given matrix

for eg

Given Matrix A:

1 0 1 1
0 0 1 1
2 2 3 3
2 2 4 0


the required code should give me the no of zeros as 4

Please post your views on the topic.

This isn't a matter of "views" (opinions), it's a matter of knowing enough
basic Java to count the zero values in an array. Are you saying that you
don't know how to do this? That sounds like a homework question, in which
case it is better asked at comp.lang.java.help. When you post there, please
provide code so that we know what datatype the array is, how, many
dimensions it has, and how big each dimension can be. Or is it a collection?
Or a collection of arrays? Or an array of collections?
 
P

Patricia Shanahan

Nish said:
Hi all,
i want to find a mat lab algorithm in order to count number of
zeros in any given matrix

for eg

Given Matrix A:

1 0 1 1
0 0 1 1
2 2 3 3
2 2 4 0


the required code should give me the no of zeros as 4

Please post your views on the topic.

thanks

Nishant

(e-mail address removed)

My view of the topic is that it would be much more appropriate for a
Matlab group than here. However, even in a Matlab newsgroup it might be
considered to look a bit too much like homework to be a really
appropriate question.

I have written enough Matlab to know that a good Matlab solution is
unlikely to have much resemblance to any Java solution. Many
participants in this newsgroup will not even know that much.

Patricia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top