Comparing sets of data

1 Ansicht (letzte 30 Tage)
charles atlas
charles atlas am 22 Nov. 2011
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?

Akzeptierte Antwort

Fangjun Jiang
Fangjun Jiang am 22 Nov. 2011
x=round(rand(10,1));
y=1:10;
index=x==0;
y(index)=0;

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by