将混合数字字符串内容的表转换为数组

时间:2019-05-13 13:33:08

标签: matlab

我有一个包含数字和字符串内容混合的表:

M = 

    rep           file           condition    corrAns
    ___    __________________    _________    _______

    1      'stimuli/03C1.wav'    'C1'         2      
    1      'stimuli/03C4.wav'    'C4'         1 
......................

我想将M转换为数组,以便能够使用xlswrite将其保存为电子表格,这需要输入数组。

但是,命令table2array(M)给出了错误

Cannot concatenate the table variables 'rep' and 'file', because their types are double and cell.

我尝试使用

将第一列和最后一列从double转换为cell
M(:,1) = table2cell(M(:,1))

甚至

for i_row=1:row_N
    M(i_row,1) = num2cell(M(i_row,1));
    M(i_row,4) = num2cell(M(i_row,4));
end

,但是这些转换都导致相同的错误。有什么建议吗?

0 个答案:

没有答案