mat2strIntDouble

Below is a demonstration of the features of the mat2strIntDouble function

Contents

clear; close all; clc;

Syntax

[t]=mat2strIntDouble(varargin);

Description

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=[];

Examples

Example 1: Using default settings

[t]=mat2strIntDouble(pi)

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

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

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

    '3.1415927e+00'


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

optionStruct.formatDouble='%6.2f';
optionStruct.formatInteger='%d';
optionStruct.dlmChar='/';
optionStruct.rowWrapLength=[];

[t]=mat2strIntDouble(pi,optionStruct)

[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'

GIBBON www.gibboncode.org

Kevin Mattheus Moerman, [email protected]

GIBBON footer text

License: https://github.com/gibbonCode/GIBBON/blob/master/LICENSE

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 http://www.gnu.org/licenses/.