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 Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by