remove negative values from one column and the corresponding data in another coloumn
조회 수: 7 (최근 30일)
이전 댓글 표시
Please, I have two coloumns of data (time and coresponding strains), I want to remove the negative values of the strains and their correponding time. I extracted the negative values of strain by x=>0. The negative values was removed successifully but the corresponding time were not.
how can I fix it. They should be equal vectors to draw them.
Thanks
댓글 수: 0
채택된 답변
Image Analyst
2023년 5월 12일
Try this:
rowsToDelete = data(:, 1) < 0; % Where values in column 1 are less than 0
data(rowsToDelete, :) = []; % Delete all columns for those rows by setting to null.
% Or alternatively you can do it this way
rowsToKeep = data(:, 1) >= 0; % Where values in column 1 are more than 0
data = data(rowsToKeep, :); % Keep all columns for those rows.
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!