REPLACE ELEMENTS OF A MATRIX
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
I need to replace the elements of the matrixA=[0 1;0 1} with matrix [1 0;1 0] if the value of elements in matrix A is 0 or with matrix [0 1;0 1] if the value of elements in matrix A is 1 so that i will get a matrix of size 8 x 8 .can you please help with the code.
3 comentarios
Alex Mcaulley
el 7 de Nov. de 2019
What have you tried?
geetha senthil
el 7 de Nov. de 2019
KALYAN ACHARJYA
el 7 de Nov. de 2019
Duplicate: Simmilar question?
Respuestas (1)
JESUS DAVID ARIZA ROYETH
el 7 de Nov. de 2019
the same way :
matrixA=[0 1;0 1];
s=matrixA==0;
if0=[1 0;1 0];
if1=[0 1;0 1];
R=num2cell(matrixA);
R(s)={if0};
R(not(s))={if1};
R=cell2mat(R)
La pregunta está cerrada.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!