필터 지우기
필터 지우기

Evaluate first column data, set remaining columns to zero based on first column value.

조회 수: 2 (최근 30일)
I have a matrix of data, several rows, 4 columns and I want to look at the first column value and if it is above or below a certain value, set all the remaining columns in that row to zero. Sounds simple, but struggling to figure it out.

채택된 답변

Walter Roberson
Walter Roberson 2017년 4월 26일
mask = YourMatrix(:,1) > TheHighCutoff | YourMatrix(:,1) < TheLowCutoff;
YourMatrix(mask,2:end) = 0;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Word games에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by