Creating a cell array pattern where output is a binary matrix

11 vues (au cours des 30 derniers jours)
Kaitlyn Nicol
Kaitlyn Nicol le 20 Jan 2022
Commenté : Kaitlyn Nicol le 20 Jan 2022
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 !

Réponses (1)

Image Analyst
Image Analyst le 20 Jan 2022
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'

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by