The str2double function is taking too long?
古いコメントを表示
The built-in function "str2double" is very time consuming when I want to convert an array of string type to an array of numertic type, especially when I have an array of string type with many elements(46259*503 size). Is there any way to improve the performance?
my os: win10
matlab 2021a
当我准备把一个string类型的数组(46259*503 大小)转换为numertic类型数组时候,此内置函数“str2double”非常耗时,特别是我的string类型数组较多元素的时候。请问有什么办法可以提高性能?
4 件のコメント
KSSV
2021 年 6 月 10 日
Why and how you have an array of number of dimension 46259*503 into a string?
Joel Lynch
2021 年 6 月 10 日
編集済み: Joel Lynch
2021 年 6 月 10 日
If you are actually extracting that much data, then if it is formatted in a regular pattern, you should be able to speed up reading the data using sscanf(), which works because time is not spent interpreting the strings
xingxingcui
2021 年 6 月 10 日
編集済み: xingxingcui
2021 年 6 月 10 日
Walter Roberson
2021 年 6 月 10 日
T3 = readmatrix('_040825_1735_IS.log', 'delimiter',' ');
That gives 46264 rows, 502 variables, everything already numeric.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!