want to convert vector to cell

7 vues (au cours des 30 derniers jours)
rishika yadav
rishika yadav le 27 Juil 2022
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'}

Réponse acceptée

David Hill
David Hill le 27 Juil 2022
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'}

Plus de réponses (0)

Catégories

En savoir plus sur Data Type Conversion 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