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일
a=[ 1
1
0
0
1 ];
out = [a, ~a]+0;

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data 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