Element replacement in a vector

3 Ansichten (letzte 30 Tage)
yashar khatib shahidi
yashar khatib shahidi am 3 Mai 2015
Beantwortet: Image Analyst am 3 Mai 2015
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

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by