Effacer les filtres
Effacer les filtres

how to load fisheriris data set by reducing the number of sample for each species

32 vues (au cours des 30 derniers jours)
I am using fisheriris data set in my matlab code.
As fisheriris contain 3 species of 50 samples each.In total it contains 150 samples with 4 features.
Could anyone help me how to load 3 samples from 3 species inorder to make in total 9 samples containing 4 features.
  1 commentaire
Rik
Rik le 30 Jan 2019
I don't have the required toolbox, so this file is not available for me:
fullfile(matlabroot, 'toolbox', 'stats', 'statsdemos', 'fisheriris.mat')
But this looks like you should be able to load this file, and use the species variable to separate the different species.
Do you want to have a random selection of 3 of each species?

Connectez-vous pour commenter.

Réponse acceptée

KSSV
KSSV le 30 Jan 2019
load fisheriris.mat ;
str = unique(species) ;
% pick any three randomly
pos = zeros(3,3) ;
for i = 1:3
idx = find(contains(species,str{i})) ;
pos(:,i) = randsample(idx,3) ;
end
iwant = meas(pos(:),:)
  8 commentaires
Adolfo Jaimes
Adolfo Jaimes le 19 Nov 2022
what does meas mean in matlab?
Rik
Rik le 19 Nov 2022
Nothing specific. It is simply one of the variables stored in this example data. It is probably short for measurement.

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by