I'm trying to write an m-file in matlab that can count how many data point in a vector are zero, how many are 1, etc. I can call the vector and get the length, max and min values, but I also need to be able to call each element seperatly and I can't figure out how to do this. I've been playing around and this is what i have:(adsbygoogle = window.adsbygoogle || []).push({});

function len (A)

N= length(A);

M =max(A);

m=min(A);

S=0;

for i=1:N

if

A[i,1]=0;

S=S+1;

end

len=N

MAX =M

MIN=m

zero=S

But it says expression (A=[i,1]=0) is incomplete. I've tried a few other expressions but none work. Any help is appreciated.

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Help with matrix in m file

Loading...

Similar Threads - Help matrix file | Date |
---|---|

C/++/# Help with MATLAB code? | Feb 9, 2018 |

Help with cblas_dgemm matrix multiplication | Dec 5, 2012 |

FORTRAN help: Reading unknown Quantity of data from file to Allocatable Array/matrix | Nov 15, 2012 |

C++ Matrix Constructor Help | Oct 27, 2008 |

Help with 3D matrix, 3D spreadsheet. | May 25, 2008 |

**Physics Forums - The Fusion of Science and Community**