Counting number of zeros in an array

Discussion in 'C++' started by Nishant, May 18, 2006.

  1. Nishant

    Nishant Guest

    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

    Nishant, May 18, 2006
    #1
    1. Advertising

  2. Nishant

    red floyd Guest

    Nishant wrote:
    > 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)
    red floyd, May 18, 2006
    #2
    1. Advertising

  3. "Nishant" <> wrote in message
    news:...
    > 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

    > thanks
    >
    > Nishant
    >
    >
    Stuart Golodetz, May 18, 2006
    #3
  4. Nishant

    red floyd Guest

    Stuart Golodetz wrote:
    > "Nishant" <> wrote in message
    > news:...
    >> 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
    >


    You're a heck of a lot more polite than I was, Stu! :) Nicely phrased!
    red floyd, May 18, 2006
    #4
  5. red floyd wrote:
    > Nishant wrote:
    >
    >> 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


    if number == 0
    count++;

    HOW HARD CAN IT BE?


    Best regards / Med venlig hilsen
    Martin Jørgensen

    --
    ---------------------------------------------------------------------------
    Home of Martin Jørgensen - http://www.martinjoergensen.dk
    =?ISO-8859-1?Q?Martin_J=F8rgensen?=, May 18, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nish
    Replies:
    3
    Views:
    815
    Patricia Shanahan
    May 18, 2006
  2. ThePotPlants

    Number padding... (trailing zeros'.)

    ThePotPlants, May 23, 2004, in forum: Perl Misc
    Replies:
    4
    Views:
    387
    ThePotPlants
    May 23, 2004
  3. Replies:
    4
    Views:
    115
  4. Dave Angel
    Replies:
    0
    Views:
    158
    Dave Angel
    Mar 5, 2013
  5. Terry Reedy
    Replies:
    0
    Views:
    140
    Terry Reedy
    Mar 6, 2013
Loading...

Share This Page