I want to replace specific elements within an array with a user input.
For example, the array will contain [a b c d e f g] and the user will input 3 values corresponding to 3 symbols (e.g a=1, c=2, g=6) and the final array will be [1 b 2 d e f 6]
The solution will have to be viable for a 12x1 matrix .
Thanks

 채택된 답변

madhan ravi
madhan ravi 2018년 11월 13일
편집: madhan ravi 2018년 11월 13일

0 개 추천

syms a b c d e f g %requires symbolic toolbox
A=[a b c d e f g]
finalarray=subs(A,{'a','c','g'},{'1','2','6'})

댓글 수: 3

madhan ravi
madhan ravi 2018년 11월 13일
If it was what you were looking for make sure to accept the answer else let know
That's perfect, thank you.
madhan ravi
madhan ravi 2018년 11월 13일
Anytime :)

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

추가 답변 (0개)

제품

릴리스

R2017a

질문:

2018년 11월 13일

댓글:

2018년 11월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by