Creating a cell array pattern where output is a binary matrix

조회 수: 2 (최근 30일)
Kaitlyn Nicol
Kaitlyn Nicol 2022년 1월 20일
댓글: Kaitlyn Nicol 2022년 1월 20일
I'm looking to create a 1D cell array that gives this pattern in a binary matrix as the output.
I know that this needs to be 16x1 pattern and black = 0 and white = 1, but I am unsure where to start.
Any advice would be greatly appreciated !

답변 (1개)

Image Analyst
Image Analyst 2022년 1월 20일
Here's a start
v = 0 : 15
v = 1×16
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
c = dec2bin(v)
c = 16×4 char array
'0000' '0001' '0010' '0011' '0100' '0101' '0110' '0111' '1000' '1001' '1010' '1011' '1100' '1101' '1110' '1111'

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by