Below is a demonstration of the features of the mat2strIntDouble function


clear; close all; clc;




This function converts an array (scalar, 1D, 2D, or 3D) into a formatted string. The following defaults are used.

defaultOptionStruct.formatDouble='%6.7e'; defaultOptionStruct.formatInteger='%d'; defaultOptionStruct.dlmChar=','; defaultOptionStruct.rowWrapLength=[];


Example 1: Using default settings


[t]=mat2strIntDouble([pi pi/2])

[t]=mat2strIntDouble([pi pi/2 3; 0 -13.5 1])

[t]=mat2strIntDouble([1 2 3])
t =


t =

    '3.1415927e+00, 1.5707963e+00'

t =

    '3.1415927e+00, 1.5707963e+00, 3.0000000e+00
     0.0000000e+00, -1.3500000e+01, 1.0000000e+00'

t =

    '1, 2, 3'

Example 2: Making custom settings



[t]=mat2strIntDouble([pi pi/2],optionStruct)

[t]=mat2strIntDouble([pi pi/2 3; 0 -13.5 1],optionStruct)

[t]=mat2strIntDouble([1 2 3],optionStruct)
t =

    '  3.14'

t =

    '  3.14/   1.57'

t =

    '  3.14/   1.57/   3.00
       0.00/ -13.50/   1.00'

t =

    '1/ 2/ 3'


Kevin Mattheus Moerman, [email protected]

GIBBON footer text


GIBBON: The Geometry and Image-based Bioengineering add-On. A toolbox for image segmentation, image-based modeling, meshing, and finite element analysis.

Copyright (C) 2006-2023 Kevin Mattheus Moerman and the GIBBON contributors

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see