Creating Matrix based on grouping of elements in cell array

2 visualizzazioni (ultimi 30 giorni)
Say I have a cell array where each cell describes a group of numbers. I want a matrix that describes these groups in a logical manner. Here is an example:
C = {[1 3], [2], [4 5 6]},
I want A = [0 0 1 0 0 0;0 0 0 0 0 0;1 0 0 0 0 0;0 0 0 0 1 1;0 0 0 1 0 1;0 0 0 1 1 0]
Thanks

Risposte (1)

KALYAN ACHARJYA
KALYAN ACHARJYA il 18 Ago 2020
A=de2bi(cell2mat({[1 3],[2],[4 5 6]}),6)

Categorie

Scopri di più su Data Types in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by