want to convert vector to cell

조회 수: 6 (최근 30일)
rishika yadav
rishika yadav 2022년 7월 27일
답변: David Hill 2022년 7월 27일
i am dealing with a colum vectror A= [1 2 2 3 2 ]
need to convert this vector in a cell form with element seprated by commas A ={ '1','2','2','3','2'}

채택된 답변

David Hill
David Hill 2022년 7월 27일
A= [1 2 2 3 2 ]
A = 1×5
1 2 2 3 2
B=mat2cell(num2str(A'),ones(1,length(A)),1)'
B = 1×5 cell array
{'1'} {'2'} {'2'} {'3'} {'2'}
Which is the same as:
C ={ '1','2','2','3','2'}
C = 1×5 cell array
{'1'} {'2'} {'2'} {'3'} {'2'}

추가 답변 (0개)

카테고리

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