how to restrict sample for data analysis?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
mathxaz
am 23 Jan. 2019
Kommentiert: mathxaz
am 23 Jan. 2019
Hello everyone!
I have to following problem: I use a .mat file for my data analysis and only want to include observations of males. I have a dummy variable that codes observation of males by 0, but I cannot find a solution to restrict my sample to males only.
My data set contains approximately 20 variables for each observation (=person).
I hope this information is sufficient.
Thanks for your help!
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 23 Jan. 2019
mask = YourData(:, index_of_dummy_variable) == 0;
MaleData = YourData(mask, :);
The above assumes that the dummy variable is coded as a column of the data and that index_of_dummy_variable is the column number it is in.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!