how can I edit a matrix and rename it at the same time?
Mostrar comentarios más antiguos
I start with a random matrix and edit the 8th column to new numbers and then rename it. what I thought was this:
my_matrix = rand(4,9)
my_matrix(:,8) = [2;4;6;1]
edited_matrix = my_matrix
however, I want to rename and edit the matrix in one go so at the end of the script, I have two matrices...
Almost like this (but this doesnt work)
my_matrix = rand(4,9)
edited_matrix = [my_matrix(:,8) = [2;4;6;1]]
so at the end I have two variables, my_matrix and edited_matrix that are different and can be reffered to separately
Respuesta aceptada
Más respuestas (1)
Thorsten
el 25 de Nov. de 2019
You can do it like this:
my_matrix = rand(4,9);
edited_matrix = my_matrix;
edited_matrix(:,8) = [2;4;6;1];
1 comentario
Matthew Perry
el 25 de Nov. de 2019
Categorías
Más información sobre Calendar en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!