Counting number of zeros in an array

Discussion in 'Java' started by Nish, May 18, 2006.

  1. Nish

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

    Please post your views on the topic.

    thanks

    Nishant

     
    Nish, May 18, 2006
    #1
    1. Advertisements

  2. Nish

    Oliver Wong Guest

    "Nish" <> 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
    >
    > 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
     
    Oliver Wong, May 18, 2006
    #2
    1. Advertisements

  3. Nish

    Rhino Guest

    "Nish" <> 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
    >
    > 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?

    --
    Rhino
     
    Rhino, May 18, 2006
    #3
  4. Nish 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
    >
    >
    > the required code should give me the no of zeros as 4
    >
    > Please post your views on the topic.
    >
    > thanks
    >
    > Nishant
    >
    >
    >


    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
     
    Patricia Shanahan, May 18, 2006
    #4
    1. Advertisements

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. ranjmis
    Replies:
    14
    Views:
    648
    Ben C
    Mar 12, 2006
  2. Nishant
    Replies:
    4
    Views:
    1,824
    =?ISO-8859-1?Q?Martin_J=F8rgensen?=
    May 18, 2006
  3. Adam Akhtar
    Replies:
    9
    Views:
    157
    Robert Klemme
    Jan 31, 2008
  4. ThePotPlants

    Number padding... (trailing zeros'.)

    ThePotPlants, May 23, 2004, in forum: Perl Misc
    Replies:
    4
    Views:
    982
    ThePotPlants
    May 23, 2004
  5. Jack
    Replies:
    22
    Views:
    433
    Ted Zlatanov
    Aug 10, 2006
  6. Jack
    Replies:
    2
    Views:
    182
    -berlin.de
    Jul 30, 2006
  7. Replies:
    4
    Views:
    277
  8. Roy Smith
    Replies:
    1
    Views:
    209
    jmfauth
    Mar 6, 2013
Loading...