セルを倍精度実数に変換するには?
Show older comments
例えば、aが以下のような11x1のセル配列であるとします。
a =
'0.000000'
'1.000000'
'2.000000'
'3.000000'
'4.000000'
'5.000000'
'6.000000'
'7.000000'
'8.000000'
'9.000000'
'10.000000'
これを倍精度実数に変換したいと考えています。b=cell2mat(a)を試みたところ、以下のエラーが発生しました:
??? Error
using ==> cat
CAT
arguments dimensions are not consistent.
Error
in ==> cell2mat at 85
m{n} = cat(1,c{:,n});
ただし、ループと2段階の変換を使えば回避できることは知っています:
for i = 1:length(a)
b(i) = str2num(cell2mat(a(i)));
end
そこで、もっと簡単に一段階でこの変換を行う方法があるのか疑問に思っています。
Accepted Answer
More Answers (0)
Categories
Find more on データ型の変換 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!