Segmenting an original .mat file
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a .mat file with a data matrix (22 columns and 1780 rows). I also have a "marker" column (1 column and 1780 rows)with mostly 0s and then some other numbers. I want to segment this original .mat file as follows: -find odd positions of markers 2 and 3 in the marker column (for example the 1st, 3rd, and 5th "2"; and the same for 3)and the even positions of marker 6 (for example the second, 4th, and 6th position). -segment the .mat file so that data from odd position of marker 2 and the following even position of marker 6 are saved an another .mat file named XXX1 and data from the odd position of marker 3 and the even position of marker 6 that follows it are saved as another .mat file named xxx2...and so on.
-I don't know if this is possible or if it's easy or difficult to do this so any feedback is really appreciated!
1 Kommentar
Rik
am 17 Mär. 2017
You can use logical indexing to do this. You could even auto-generate the filenames with sprintf, but I don't really see te system in your numbering. So you can select your data with
select_twos=find(marker==2);
select_odd_twos=select_twos(1:2:end);
selected_data=data(select_odd_twos,:);
Antworten (0)
Siehe auch
Kategorien
Mehr zu Structures 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!