You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
This is a small M-file that can be thought of as the inverse of the colon operator: it takes a linearly spaced row vector and generates a compact notation for that vector.
It handles concatenations of such vectors too, and will in fact for any real array (subject to considerations of numerical precision) generate a valid string representation of that array as a reshaped row vector.
I wrote this because I found myself using input dialog boxes in a GUI, where a numeric vector is entered as a string to be parsed by str2num, and I wanted to provide the current value of the vector as the default answer. mat2str already does this, but the result is unwieldy for all but the smallest arrays, so that was not really useful in this context.
Cite As
Sven Bossuyt (2026). vector to string (https://www.mathworks.com/matlabcentral/fileexchange/26453-vector-to-string), MATLAB Central File Exchange. Retrieved .
General Information
- Version 1.2.0.0 (2.26 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
| Version | Published | Release Notes | Action |
|---|---|---|---|
| 1.2.0.0 | generate error immediately if array is not numeric
|
||
| 1.1.0.0 | * fixed bug where end of one subsequence is start of next one
|
||
| 1.0.0.0 |
