change last element in array by specific value matlab

조회 수: 21 (최근 30일)
ha ha
ha ha 2019년 6월 8일
댓글: ha ha 2019년 6월 8일
Let's say I have matrix a
a=[1 2 3 4 5 6 7 8 9];
it's observed that the last value of array a is "9".
I want to change this value to be 1
Hope result is:
reslut=[1 2 3 4 5 6 7 8 1];

채택된 답변

madhan ravi
madhan ravi 2019년 6월 8일
편집: madhan ravi 2019년 6월 8일
Result = a;
if Result(end) == specific_value % specific value is 9 for example
Result(end) = 1;
end
  댓글 수: 4

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by