Creating Matrix based on grouping of elements in cell array

조회 수: 3 (최근 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 CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by