X(i1:i2) = X(i1:i2) - const;
Do I have to use X(i1:i2) twice in the line to achieve the result above?

답변 (2개)

Image Analyst
Image Analyst 2015년 10월 18일

0 개 추천

Yes, that's correct.
Would you expect some other way to add a constant to just some of the elements in the vector? If so, what?
Walter Roberson
Walter Roberson 2015년 10월 18일

0 개 추천

idx = i1:i2;
X(idx) = X(idx) - const;

카테고리

태그

질문:

2015년 10월 18일

답변:

2015년 10월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by