******************************************************************************
Codigo para la creacion de un histograma de una matriz de mxn
******************************************************************************
******************************************************************************
clear;
k=1;
cont=0;
temp=0;
max=0;
fil=input('ingrese filas: ') ;
col=input ('ingrese columnas: ') ;
for i=1:fil
for j=1:col
A(i,j)=input('valor: ');
A(i,j)=input('valor: ');
B(k)=A(i,j); k=k+1;
end
end ;
B = ( sort(B) )
for i=1:k-1
temp=B(i);
if (temp>max)
max=temp;
end
end ;
for m=1:length(B)
for n=1:length(B)
if(B(m)== B(n))
cont=cont+1;
end
end C(m)=cont; cont=0; end; disp(cont); disp(C);
No comments:
Post a Comment