The str2double function is taking too long?
Mostrar comentarios más antiguos
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 comentarios
KSSV
el 10 de Jun. de 2021
Why and how you have an array of number of dimension 46259*503 into a string?
Joel Lynch
el 10 de Jun. de 2021
Editada: Joel Lynch
el 10 de Jun. de 2021
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
el 10 de Jun. de 2021
Editada: xingxingcui
el 10 de Jun. de 2021
Walter Roberson
el 10 de Jun. de 2021
T3 = readmatrix('_040825_1735_IS.log', 'delimiter',' ');
That gives 46264 rows, 502 variables, everything already numeric.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!