Reputation: 59
everyone, I have a cell array in MATLAB:
'AA->AA' [ 9] [1.8036]
'AA->AC' [ 6] [1.2024]
'AA->AG' [13] [2.6052]
'AA->AT' [ 9] [1.8036]
I want to change it into a matrix with the row names are 'AA->AA','AA->AC'.....ect,I tried cell2mat and it reminded me: All contents of the input cell array must be of the same data type. so anyone give me an idea.
Thanks.
Upvotes: 0
Views: 145
Reputation: 114976
Use containers.Map
:
myData = containers.Map();
for ii=1:size( myCell, 1 )
myData( myCell{ii,1} ) = [myCell{ii,:}];
end
Upvotes: 1