473,379 Members | 1,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Counting number of zeros in an array

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

ni*******@rediffmail.com

May 18 '06 #1
4 4548
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)
May 18 '06 #2
"Nishant" <ni*******@rediffmail.com> wrote in message
news:11**********************@j55g2000cwa.googlegr oups.com...
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

ni*******@rediffmail.com

May 18 '06 #3
Stuart Golodetz wrote:
"Nishant" <ni*******@rediffmail.com> wrote in message
news:11**********************@j55g2000cwa.googlegr oups.com...
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!
May 18 '06 #4
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
May 18 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: The Biscuit Eater | last post by:
Ok, I am almost finished with what I was trying to accomplish (pulling future events from a csv file where the first field is the date). I was concerned that though I wanted dates entered as...
14
by: Paul C-T | last post by:
Hi, Is there a way to repeat a set of code until a certain if statement is satisfied. If it is then to exit the loop and if not repeat the code? Say I want to write a card game application in...
7
by: sathyashrayan | last post by:
Group, Following function will check weather a bit is set in the given variouble x. int bit_count(long x) { int n = 0; /* ** The loop will execute once for each bit of x set,
14
by: romayankin | last post by:
Hello All, I'm writing cross-platform code so i'm bound to standards. Here is the code I have: ~~~~~~~~~~~~~~~~~~ double **mx = new double*; for(int i = 0; i < col - 1; i++) { mx = new...
9
by: tman88g | last post by:
I've been trying to learn arrays, and I was wondering how one would go about making a program that would take from the user as many single digit numbers (0 - 9) as the user wants to enter, and then...
6
by: Matt Chwastek | last post by:
Anyone who can help, I am curretnly attempting to write some code that will allow iteration using a vector<intfrom the highest possilbe degree of a combination of ones & zeros (111, 110, 101,...
29
by: n00m | last post by:
http://www.spoj.pl/problems/SUMFOUR/ 3 0 0 0 0 0 0 0 0 -1 -1 1 1 Answer for this input data is 33. My solution for the problem is...
5
by: k4m135h | last post by:
Hi, I've come across a problem where i seem to be doing the counting of numbers in a inefficient way i've got a 200x200 array with numbers ranging from 101-600 and also 0 and 1. and i need to count...
23
by: neha_chhatre | last post by:
which is the best format specifier(data type) if i have to work with decimal number. also please tell me the syntax for truncating a decimal number please reply as soon as possible
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.