How to remove compare 2 arrays so that when there is a in a column, it removes the column in another array
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Killian Flynn
el 9 de Oct. de 2022
cvs_data =csvread('spruce tree timber quality.csv',1,0)
expert_ratings = cvs_data(:,12)' %inputs
inputs = cvs_data(:,1:11)';
correct_labels = zeros(3,length(expert_ratings));
bad = 0;
good=0;
excellent=0;
histogram(expert_ratings)
Skew1 = skewness(expert_ratings)
for k =1 : length(expert_ratings)%length(expert_ratings)
quality = cvs_data(k,12)';
if quality >= 1 && quality <=4
bad = bad+1;
correct_labels(1:3, k) =[1; 0 ; 0];
end
if quality >= 5 && quality <=6
good = good+1;
correct_labels(1:3, k) =[0; 1 ; 0];
end
if quality >= 7 && quality <=10
excellent = excellent+1;
correct_labels(1:3, k) =[0; 0 ; 1];
end
end
bad
good
excellent
correct_labels
%find bad data
%remove bad data or average it to make it good
%select the same amount of data for all qualities of trees
%remove noise from data
[good_data,rows_rem] = rmoutliers(cvs_data)
transposed_rows = rows_rem'
correct_labels
Hello. I am trying to remove a column from the correct_labels array, when there is a 0 in the corresponding column in the transposed_rows array. How could I go about doing this? Any help would be greatly appreciated.
0 comentarios
Respuesta aceptada
dpb
el 9 de Oct. de 2022
Editada: dpb
el 9 de Oct. de 2022
You have only one row logical but three rows of labels???
But, assuming that's expected and the need is to remove all columns that are false, that means KEEP those for which is true --
correct_labels=correct_labels(:,transposed_rows);
From the above, sample of the data, looks like you're ony going to keep a very small fraction...sure you're interpreting this correctly?
If, indeed, it is the obverse, then
correct_labels=correct_labels(:,~transposed_rows); % keep those columns NOT true
or, instead of keeping; remove others...
correct_labels(:,transposed_rows)=[]; % remove those columns ARE true
2 comentarios
dpb
el 9 de Oct. de 2022
Then you just negate the logical to keep or remove the logical with original sense...I'll add the code in Answer...
Más respuestas (0)
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!