mg_getRowsWithKey.cpp
Versione 1.0.0.0 (5,72 KB) da
Matthew Gunn
For each unique id, it finds the rows with that id. Mex function.
If you have a large data matrix DATA and a vector of ids ID_VECTOR, you can do the following:
[unique_ids, map] = mg_getRowsWithKey(ID_VECTOR);
for(i =1:length(unique_ids)),
group_i_data = DATA(map{i},:);
//insert what you want to do on group_i_data here
end
ID_VECTOR can either be an n by 1 vector of real doubles or an n by 1 cell array of strings
compile with mex mg_getRowsWithKey.cpp
Cita come
Matthew Gunn (2026). mg_getRowsWithKey.cpp (https://it.mathworks.com/matlabcentral/fileexchange/53913-mg_getrowswithkey-cpp), MATLAB Central File Exchange. Recuperato .
Compatibilità della release di MATLAB
Creato con
R2015b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS LinuxCategorie
Scopri di più su Structures in Help Center e MATLAB Answers
Tag
Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.
| Versione | Pubblicato | Note della release | |
|---|---|---|---|
| 1.0.0.0 | clarification |
