Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Replacing an element in a matrix, then storing it as a different variable name
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello!
I am having a hard time replacing an element in a matrix and then being able to rename the new matrix with the replaced values.
For example:
I use
x=[1 2 1; 3 4 3; 5 6 5]
I want to replace all the '3' with '4' AND be able to call the solution x2
I know that I can replace elements with the equation
x(x==3) = 4
but that changes the values in x
I want to create a new matrix with the replaced values as 'x2'
I keep running into the problem of not being able to use "=" more than once in a line of code.
Help is much appreciated!!
0 commentaires
Réponses (1)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!