- #1
Fert
- 6
- 0
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:
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.
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.