我有一张2549x28表 mydata 。有些列是字符串,有些是数字;但是表中的所有值都被读作单元格。我需要将一些单元格转换为双精度单元格。这是我做的,但它返回两个错误。
fieldsToModify = {'A','B','C','E','F','G','H', 'I', 'L', 'N', 'P', 'Q', 'R', 'S', 'U', 'Z', 'W', 'AB', 'AL', 'AO', 'AR', 'AW'};
for i=1:numel(mydata)
for j=1:numel(fieldsToModify)
mydata(i).(fieldsToModify{j}) = str2double(mydata(i).(fieldsToModify{j}));
end
end
我得到的错误:
Error using table/subsrefParens (line 14)
You cannot subscript a table using only one subscript. Table subscripting requires both row and variable subscripts.
Error in table/numArgumentsFromSubscript (line 390)
x = subsrefParens(t,s(1));