Creating a cell array pattern where output is a binary matrix

11 ビュー (過去 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 Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by