int i;
int y1;
int y2;
int y3;
int y4;
int y5;
int y6;
int y7;
for (i=0; i<100; i++){
if(x[i]>=m && x[i]<m+s)
y1++;
else if (x[i]>=m+s && x[i]<m+2*s)
y2++;
else if (x[i]>=m+2*s && x[i]<m+3*s)
y3++;
else if (x[i]>=m+3*s && x[i]<m+4*s)
y4++;
else if (x[i]>=m+4*s && x[i]<m+5*s)
y5++;
else if (x[i]>=m+5*s && x[i]<m+6*s)
y6++;
else if (x[i]>=m+6*s && x[i]<=m+7*s)
x is a 1×100 array
m is a minimum value of an array
s is a step (constant value)
Can You help to rewrite this cycle using Matlab?
Best Answer