About Site Map Submit Contact Us Log in | Create an account
Create an account Log In
Average Rating
User Rating:
Visitors Rating:
My rating:

Write review
  • License: Freeware
  • Last update: 5 years ago
  • Total downloads: 99
  • Price: Free |
  • Operating system: Linux, Mac OS X, Win All, BSD, Solaris
  • Publisher: Lauri Tamminen (1 other programs)
See full specifications

scripts default iconFast String to Double Conversion (Scripts) Publisher's description

str2doubleq is equivalent to the Matlab built-in str2double function that converts char or cellstr array to appropriate double arrays

str2doubleq is equivalent to the Matlab built-in str2double function that converts char or cellstr array to appropriate double arrays. The drawback of built-in str2double is that it becomes very slow when the dataset becomes larger.

str2doubleq exploits the mex-gateway to use c++ fast string handling capabilities and the std::stringstream properties. The conversion uses same ideas that is used in boost::lexical_cast

Function has been tried to program exactly the same as str2double. However it does not currently support complex numbers. This means that it returns NaN values for inputs of type 'd+[+-]id+'

Original demand for the function arised from certain market data parsing problems that had to be done in real time. Now Matlab can be as fast as traditional programming languages in these types of string parsing problems.


*Copy the file str2doubleq.cpp somewhere in hard drive. (Example C:Teststr2doubleq.cpp)

*Launch Matlab and compile the source file to generate machine dependent binary. If you have not selected a compiler this needs to be done first (run mex -setup in command window).

* Source is compiled typing mex <c-source folder>
(Example mex C:Teststr2doubleq.cpp)

*Place the generated str2doubleq.mexw32 (32-bit) or str2doubleq.mexw64 (64-bit) to Matlab's scope (set path- folder group)

Now you can use the function in normal matlab fashion. Run the testcases script TestPerformance (included in zip-file)

* Segmentation violation bug fixed.
* Fixed a bug when empty array was passed. Now str2doubleq returns NaN instead of empty array. (Consistent with str2double)
*Tweaked some extra performance by defining istringstream to be static variable inside the string_to_double helper function. This prevents the overhead that is being built in istringstream constructor in subsequent calls to function.
*Made a note in the code about atof usage. Atof is propably the most optimal way to make the conversion. However its behaviour is not the same as built-in str2double (see the notes in source)

System Requirements:

MATLAB 7.11 (2010b)
Program Release Status: New Release
Program Install Support: Install and Uninstall

Fast String to Double Conversion (Scripts) Tags:

Click on a tag to find related softwares

Is Fast String to Double Conversion (Scripts) your software?

Manage your software

Most Popular

scripts default icon ASK, OOK, FSK, BPSK, QPSK, 8PSK modulation 1.1
ASK, OOK, FSK, BPSK, QPSK, 8PSK modulation contain several functions for digital modulation simulation
scripts default icon Simulink Communication Labs 1.1
Simulink Communication Labs allows you to learn communication systems in greater depth.
scripts default icon M-QAM modulation and demodulation 1.1
M-QAM modulation and demodulation is the QAM modulation and demodulation tech.
scripts default icon LZW Compression/Decompression 1.1
LZW Compression/Decompression - Updated LZW compressor and decompressor with reasonable performance
scripts default icon InSPIRE utility to plot a 2D displacement field (Scripts) 1.0
This program plots the deformation field (displace vectors) contained in vector.txt.