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

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 日

0 投票

a=[ 1
1
0
0
1 ];
out = [a, ~a]+0;

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Types についてさらに検索

タグ

質問済み:

2014 年 4 月 3 日

コメント済み:

2014 年 4 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by