Comparing sets of data

조회 수: 1 (최근 30일)
charles atlas
charles atlas 2011년 11월 22일
I have a column of data that has a bunch of numbers indicating height of something. I have another column of data also indicating the height of something (they both have the same number of values). I want to say for every time a value in column X = 0, change the value that was in Y at the same location to 0.
I am not sure how to do this. Maybee an IF statement?

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 11월 22일
x=round(rand(10,1));
y=1:10;
index=x==0;
y(index)=0;

추가 답변 (0개)

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by