Usage: strMat = mat2colon(Matrix, options)
Options are:
'Delimiter' - 'on','yes','off','no' {default on} : Including square brackets []
(or curly brackets {} when output's dimensions are not consistent)
'auto' by default.
'Sort' - 'on','yes','off','no' {default off} : Sort elements in ascending order
'Class' - MATLAB classes
'Repeat' - 'on','yes','off','no' {default on} : Keep repeated elements
Same as vect2colon but matrix capability
Example 1
mat2colon([14 12 10 8 6 4 2; 34 -23 0 1 45 46 47; 5 5 5 5 5 5 5])
ans =
[ 14:-2:2; 34 -23 0 1 45:47; 5 5 5 5 5 5 5]
Example 2
mat2colon([14 12 10 8 6 4 2; 34 -23 0 1 45 46 47; 5 5 5 5 5 5 5], 'Repeat', 'no')
ans =
{[ 14:-2:2];[ 34 -23 0 1 45:47];[ 5]}
See also: vect2colon, eval, str2num
Feedback is appreciated. |