Segmenting an original .mat file
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Rik
2017 年 3 月 17 日
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,:);
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!