Counting number of zeros in an array

N

Nishant

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 matlab code should give me the no of zeros as 4

Please post your views on the topic.

thanks

Nishant

(e-mail address removed)
 
R

red floyd

Nishant 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

1. do your own homework
2. If you're looking for matlab code, why are you posting in
comp.lang.c++ instead of comp.soft-sys.matlab?
3. RTFD (read the friggin' docs)
 
S

Stuart Golodetz

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

Any particular reason youi're posting this to a C++ newsgroup rather than a
MATLAB one then? Just as importantly, why do you want to *find* such an
algorithm? Wouldn't writing one be more interesting? Just a thought...
<snip>
Please post your views on the topic.

Glad to (see above) :) If you wanted actual code, I'm afraid you posted in
the wrong newsgroup. I recommend comp.soft-sys.matlab. Or writing it
yourself.

Cheers,
Stu
 
R

red floyd

Stuart said:
Any particular reason youi're posting this to a C++ newsgroup rather than a
MATLAB one then? Just as importantly, why do you want to *find* such an
algorithm? Wouldn't writing one be more interesting? Just a thought...


Glad to (see above) :) If you wanted actual code, I'm afraid you posted in
the wrong newsgroup. I recommend comp.soft-sys.matlab. Or writing it
yourself.

Cheers,
Stu

You're a heck of a lot more polite than I was, Stu! :) Nicely phrased!
 
?

=?ISO-8859-1?Q?Martin_J=F8rgensen?=

if number == 0
count++;

HOW HARD CAN IT BE?


Best regards / Med venlig hilsen
Martin Jørgensen
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top