How do I find specific variables out of 2 different arrays?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Delany MacDonald
am 30 Mär. 2016
Beantwortet: Star Strider
am 30 Mär. 2016
I am given two different arrays. One is called wakeTimes and it is a 21 x 345 array. The other is, Section that is 345 x 1 containing the section numbers the subjects are in that are (0-6) I am trying to find the students that are in ONLY section 1 from the wake times. I understand you would have to use vector logic but how do i only pull out the information for those students.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 30 Mär. 2016
I created data and tested it with this code:
M = randi(9, 25, 6); % Wake Times
S = randi([0 6], 25, 1); % Sections
Out = M(S == 1, :); % Select Only Section ‘1’
It works.
Make the appropriate variable name substitutions to use it with your matrices and vector.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Types finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!