Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

Andrei Bobrov
Andrei Bobrov il 3 Apr 2014
Modificato: Andrei Bobrov il 3 Apr 2014
a=[ 1
1
0
0
1 ];
out = [a, ~a]+0;

Più risposte (0)

Categorie

Scopri di più su Data Types in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by