To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016
I need to create a function where I have a matrix and the function returns the number of zeros in that matrix. I need to do this using the if condition.
Then write in a .txt file which columns had more than 12 zeros.
Can someone help me out with this?
Thank you very much.
No products are associated with this question.
The number of zeros in the matrix A is:
So we can make this a function:
f = @(x) sum(~x(:));
Now test it:
x = [1 2 3;0 0 0;3 0 9] f(x)