Converting a structure to a matrix

2 ビュー (過去 30 日間)
Chaz
Chaz 2015 年 3 月 25 日
回答済み: Jan 2015 年 3 月 25 日
I'm trying to get some data from a xls spreadsheet to a matrix. At the moment I've gotten thus far:
conLogChans=importdata('Control_Log_Channel_Allocation_Drivven.xls');
conLogChans=struct2cell(conLogChans);
conLogChans=conLogChans{1,1};
But if I now try the cell2mat command I get the error:
Error using cat
Dimensions of matrices being concatenated are not consistent.
Error in cell2mat (line 83)
m{n} = cat(1,c{:,n});
I thought the error was to do with some of the cells having no data in them, so I put some data in them however the error is still appearing. Any suggestions on how to do this? The data is all strings if it makes a difference.
Thank you.

回答 (1 件)

Jan
Jan 2015 年 3 月 25 日
The error message is clear: The array in the cell need the same number of columns, when you want to concatenate them. So check the sizes of the arrays at first.

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by