Creating Matrix based on grouping of elements in cell array

2 ビュー (過去 30 日間)
Chad
Chad 2020 年 6 月 15 日
回答済み: KALYAN ACHARJYA 2020 年 8 月 18 日
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
  1 件のコメント
Chaitanya Mallela
Chaitanya Mallela 2020 年 8 月 18 日
Can you demostrate the logical operation which you want to perform on cell array C ?

サインインしてコメントする。

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 8 月 18 日
A=de2bi(cell2mat({[1 3],[2],[4 5 6]}),6)

カテゴリ

Help Center および File ExchangeData Types についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by