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

1 次查看(过去 30 天)
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

采纳的回答

Andrei Bobrov
Andrei Bobrov 2014-4-3
编辑:Andrei Bobrov 2014-4-3
a=[ 1
1
0
0
1 ];
out = [a, ~a]+0;

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Types 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by