Element replacement in a vector

조회 수: 4 (최근 30일)
yashar khatib shahidi
yashar khatib shahidi 2015년 5월 3일
답변: Image Analyst 2015년 5월 3일
Hi there. I have a row vector like a = [3 4 6 8 9] then I want to replace third element which is 6 with 5 and 8 so the new vector becomes b = [3 4 5 8 8 9]. What is the function to convert the vector. Thanks

채택된 답변

Image Analyst
Image Analyst 2015년 5월 3일
Try this:
b = [a(1:2), 5, 8, a(4:end)]

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by