mirror of
https://github.com/Doctorado-ML/Stree_datasets.git
synced 2025-08-17 08:26:02 +00:00
32 lines
746 B
Matlab
Executable File
32 lines
746 B
Matlab
Executable File
printf('lendo problema %s ...\n', problema);
|
|
|
|
n_entradas= 60; n_clases= 2; n_fich= 1; fich{1}= 'sonar.all-data'; n_patrons(1)= 208;
|
|
|
|
n_max= max(n_patrons);
|
|
x = zeros(n_fich, n_max, n_entradas); cl= zeros(n_fich, n_max);
|
|
|
|
n_patrons_total = sum(n_patrons); n_iter=0;
|
|
clase={'M','R'};
|
|
|
|
for i_fich=1:n_fich
|
|
f=fopen(fich{i_fich}, 'r');
|
|
if -1==f
|
|
error('erro en fopen abrindo %s\n', fich{i_fich});
|
|
end
|
|
for i=1:n_patrons(i_fich)
|
|
fprintf(2,'%5.1f%%\r', 100*n_iter++/n_patrons_total);
|
|
for j = 1:n_entradas
|
|
x(i_fich,i,j) = fscanf(f,'%f',1); fscanf(f,'%c',1);
|
|
end
|
|
t = fscanf(f,'%c',1); % lectura da clase
|
|
if t=='M'
|
|
cl(i_fich,i)=0;
|
|
elseif t=='R'
|
|
cl(i_fich,i)=1;
|
|
else
|
|
error('clase %c descoñecida')
|
|
end
|
|
end
|
|
fclose(f);
|
|
end
|