A way to replace a single number array to a double array.

1 visualización (últimos 30 días)
Andre
Andre el 3 de Abr. de 2014
Comentada: Andre el 3 de Abr. de 2014
Hi, there is a simple way (like array(array(:)==1)=5), to do this:
array=
[ 1
1
0
0
1 ];
to
array=
[ 1 0
1 0
0 1
0 1
1 0 ];
Andre

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 3 de Abr. de 2014
Editada: Andrei Bobrov el 3 de Abr. de 2014
a=[ 1
1
0
0
1 ];
out = [a, ~a]+0;

Más respuestas (0)

Categorías

Más información sobre Data Types en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by