MrD
MrD

Reputation: 5086

Convert Cell to Matrix

I have a cell A composed of:

'hello' 'world' 'test'

I would like to convert this to a matrix.

I tried

cell2mat(A)

Which returns

     Error using cat
Dimensions of matrices being concatenated are not consistent.

Error in cell2mat (line 84)
        m{n} = cat(1,c{:,n});

I then tried

 cell2mat(A')

Which however merges all words in a single cell.

Suggestions?

Upvotes: 1

Views: 1349

Answers (1)

user2987828
user2987828

Reputation: 1137

A={'hello' 'world' 'test'};
strvcat(A{:})

Upvotes: 5

Related Questions