How would one go about trimming a matrix graphically?
조회 수: 4 (최근 30일)
이전 댓글 표시
I have multiple large datasets (doesn't everyone) that I need to figure out a quicker way of "trimming" before post processing. I need to keep the original dataset unaltered, but each of these datasets has a variable that was changed multiple times during the recording. Each dataset has the first column being time and then another twenty or so columns of sensor data. For each of these datasets, I would like to quickly plot a single column of data versus time, select a timeframe of data that has reached steady state and then save the "trimmed" dataset as a new matrix.
댓글 수: 0
채택된 답변
Renee Coetsee
2017년 3월 23일
You could accomplish this using the 'KeyPressFcn' figure callback:
When you click on the figure, you can plot a vertical line at that location. The x value of that line (which can be accessed from the line's properties) will correspond to the last (or first) value that you would like in the data matrix. You could use a button, which when pressed, will 1) duplicate the matrix, as to not modify the original 2) find the first occurrence x-value in the matrix 3) delete all elements after that x-value.
I hope these steps will help! Depending on your data, the first occurrence of an x-value may be before you want to trim. In this case, you can try finding the approximate index of the line using the line's position relative to the length of the axes.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!