我正在尝试将字符串单元格数组转换为双精度,以便我可以使用它。
hourNumbers = {'I','II','III','IV','V','VI','VII','VIII','IX','X','XI','XII'}
finHourNumbs = cell(1,length(hourNumbers))
for i=1:length(hourNumbers)
finHourNumbs {i} = str2double(hourNumbers{i});
end
我得到了以下我没想到的输出
finHourNumbs =
Columns 1 through 9
[NaN] [NaN] [NaN] [NaN] [NaN] [NaN] [NaN] [NaN] [NaN]
Columns 10 through 12
[NaN] [NaN] [NaN]
我希望它包含字符串以便我可以显示。
提前致谢