de Rigo, D. (2012). This file is part of Mastrave. Mastrave 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. Mastrave 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 Mastrave. If not, see . --------------------------------------------------------------------------- txt = int2ordinal( num , mode = 'cellstring' ) Utility to convert an integer into a string which represents its corresponding ordinal number. If the passed argument is a vector or a matrix of integers, a cell array of strings is returned, having the same size of . The optional argument (whose default value is 'cellstring') specifies the desired output format in case is scalar or empty. Input arguments: ::integer:: Matrix of integers. ::string:: Criterion for managing scalar and empty values of . (Default: 'cellstring'). Valid modes are: mode | meaning ---------------+--------------------------------- 'cellstring' | If is scalar, return a | string. Otherwise, return a | cell-array of strings. ---------------+--------------------------------- 'cellstring0' | If is empty, return an | empty string. If is | scalar, return a string. | Otherwise, return a cell-array | cell-array of strings. ---------------+--------------------------------- 'cell' | Always return a cell-array of | strings. ---------------+--------------------------------- 'cell0' | If is empty, return an | empty string. Otherwise, | return a cell-array of strings. Examples of usage: % Basic usage int2ordinal( round( randn) ) int2ordinal( round(5*randn) ) int2ordinal( round(5*randn(3,4)) ) int2ordinal( -3:21 ) int2ordinal( [-3:21].' ) % Customizing output format int2ordinal( [] , 'cellstring' ) int2ordinal( 1 , 'cellstring' ) int2ordinal( [1 2] , 'cellstring' ) int2ordinal( [] , 'cellstring0' ) int2ordinal( 1 , 'cellstring0' ) int2ordinal( [1 2] , 'cellstring0' ) int2ordinal( [] , 'cell0' ) int2ordinal( 1 , 'cell0' ) int2ordinal( [1 2] , 'cell0' ) int2ordinal( [] , 'cell' ) int2ordinal( 1 , 'cell' ) int2ordinal( [1 2] , 'cell' ) version: 0.4.3: the module "int2ordinal" of the Mastrave modelling library. In: Semantic Array Programming with Mastrave - Introduction to Semantic Computational Modelling. http://mastrave.org/doc/mtv_m/int2ordinal

This file is part of Mastrave. Mastrave 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. Mastrave 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 Mastrave. If not, see . --------------------------------------------------------------------------- txt = int2ordinal( num , mode = 'cellstring' ) Utility to convert an integer into a string which represents its corresponding ordinal number. If the passed argument is a vector or a matrix of integers, a cell array of strings is returned, having the same size of . The optional argument (whose default value is 'cellstring') specifies the desired output format in case is scalar or empty. Input arguments: ::integer:: Matrix of integers. ::string:: Criterion for managing scalar and empty values of . (Default: 'cellstring'). Valid modes are: mode | meaning ---------------+--------------------------------- 'cellstring' | If is scalar, return a | string. Otherwise, return a | cell-array of strings. ---------------+--------------------------------- 'cellstring0' | If is empty, return an | empty string. If is | scalar, return a string. | Otherwise, return a cell-array | cell-array of strings. ---------------+--------------------------------- 'cell' | Always return a cell-array of | strings. ---------------+--------------------------------- 'cell0' | If is empty, return an | empty string. Otherwise, | return a cell-array of strings. Examples of usage: % Basic usage int2ordinal( round( randn) ) int2ordinal( round(5*randn) ) int2ordinal( round(5*randn(3,4)) ) int2ordinal( -3:21 ) int2ordinal( [-3:21].' ) % Customizing output format int2ordinal( [] , 'cellstring' ) int2ordinal( 1 , 'cellstring' ) int2ordinal( [1 2] , 'cellstring' ) int2ordinal( [] , 'cellstring0' ) int2ordinal( 1 , 'cellstring0' ) int2ordinal( [1 2] , 'cellstring0' ) int2ordinal( [] , 'cell0' ) int2ordinal( 1 , 'cell0' ) int2ordinal( [1 2] , 'cell0' ) int2ordinal( [] , 'cell' ) int2ordinal( 1 , 'cell' ) int2ordinal( [1 2] , 'cell' ) version: 0.4.3: the module "int2ordinal" of the Mastrave modelling library

 

Daniele de Rigo

 


Copyright and license notice of the function int2ordinal

 

 

The file int2ordinal.m is part of Mastrave.

Mastrave 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.

Mastrave 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 Mastrave. If not, see http://www.gnu.org/licenses/.

---------------------------------------------------------------------------

txt = int2ordinal( num , mode = 'cellstring' )

Utility to convert an integer into a string which represents its corresponding ordinal number. If the passed argument num is a vector or a matrix of integers, a cell array of strings is returned, having the same size of num. The optional argument mode (whose default value is 'cellstring') specifies the desired output format in case num is scalar or empty.

Input arguments:

num ::integer:: Matrix of integers.

mode ::string:: Criterion for managing scalar and empty values of num. (Default: 'cellstring'). Valid modes are:

mode | meaning ---------------+--------------------------------- 'cellstring' | If num is scalar, return a | string. Otherwise, return a | cell-array of strings. ---------------+--------------------------------- 'cellstring0' | If num is empty, return an | empty string. If num is | scalar, return a string. | Otherwise, return a cell-array | cell-array of strings. ---------------+--------------------------------- 'cell' | Always return a cell-array of | strings. ---------------+--------------------------------- 'cell0' | If num is empty, return an | empty string. Otherwise, | return a cell-array of strings.

Examples of usage:

% Basic usage int2ordinal( round( randn) ) int2ordinal( round(5*randn) ) int2ordinal( round(5*randn(3,4)) ) int2ordinal( -3:21 ) int2ordinal( [-3:21].' )

% Customizing output format int2ordinal( [] , 'cellstring' ) int2ordinal( 1 , 'cellstring' ) int2ordinal( [1 2] , 'cellstring' )

int2ordinal( [] , 'cellstring0' ) int2ordinal( 1 , 'cellstring0' ) int2ordinal( [1 2] , 'cellstring0' )

int2ordinal( [] , 'cell0' ) int2ordinal( 1 , 'cell0' ) int2ordinal( [1 2] , 'cell0' )

int2ordinal( [] , 'cell' ) int2ordinal( 1 , 'cell' ) int2ordinal( [1 2] , 'cell' )

version: 0.4.3

Function declaration

 

 

txt = int2ordinal( num                 ,
                   mode = 'cellstring' )

Description

 

 

Utility to convert an integer into a string which represents its corresponding ordinal number. If the passed argument num is a vector or a matrix of integers, a cell array of strings is returned, having the same size of num . The optional argument mode (whose default value is 'cellstring') specifies the desired output format in case num is scalar or empty.

Input arguments

 

 


 num               ::integer::
                   Matrix of integers.

 mode              ::string::
                   Criterion for managing scalar and empty values
                   of  num .  (Default: 'cellstring').
                   Valid modes are:

                        mode            meaning
                   ────────────────────────────────────────────────
                    'cellstring'   If  num  is scalar, return a
                                   string.  Otherwise, return a
                                   cell-array of strings.
                   ────────────────────────────────────────────────
                    'cellstring0'  If  num  is empty, return an
                                   empty string.  If  num  is
                                   scalar, return a string.
                                   Otherwise, return a cell-array 
                                   cell-array of strings.
                   ────────────────────────────────────────────────
                    'cell'         Always return a cell-array of
                                   strings.
                   ────────────────────────────────────────────────
                    'cell0'        If  num  is empty, return an
                                   empty string.  Otherwise,
                                   return a cell-array of strings.


Example of usage

 

 


   % Basic usage
   int2ordinal( round(  randn)      )
   int2ordinal( round(5*randn)      )
   int2ordinal( round(5*randn(3,4)) )
   int2ordinal(  -3:21   )
   int2ordinal( [-3:21].' )

   % Customizing output format
   int2ordinal( []    , 'cellstring' )
   int2ordinal( 1     , 'cellstring' )
   int2ordinal( [1 2] , 'cellstring' )

   int2ordinal( []    , 'cellstring0' )
   int2ordinal( 1     , 'cellstring0' )
   int2ordinal( [1 2] , 'cellstring0' )

   int2ordinal( []    , 'cell0' )
   int2ordinal( 1     , 'cell0' )
   int2ordinal( [1 2] , 'cell0' )

   int2ordinal( []    , 'cell' )
   int2ordinal( 1     , 'cell' )
   int2ordinal( [1 2] , 'cell' )


version: 0.4.3

Support

 

 

The Mastrave modelling library is committed to provide reusable and general - but also robust and scalable - modules for research modellers dealing with computational science.  You can help the Mastrave project by providing feedbacks on unexpected behaviours of this module.  Despite all efforts, all of us - either developers or users - (should) know that errors are unavoidable.  However, the free software paradigm successfully highlights that scientific knowledge freedom also implies an impressive opportunity for collectively evolve the tools and ideas upon which our daily work is based.  Reporting a problem that you found using Mastrave may help the developer team to find a possible bug.  Please, be aware that Mastrave is entirely based on voluntary efforts: in order for your help to be as effective as possible, please read carefully the section on reporting problems.  Thank you for your collaboration.

Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Daniele de Rigo

This page is licensed under a Creative Commons Attribution-NoDerivs 3.0 Italy License.

This document is also part of the book:
de Rigo, D. (2012). Semantic Array Programming with Mastrave - Introduction to Semantic Computational Modelling. http://mastrave.org/doc/MTV-1.012-1


Valid XHTML 1.0 Transitional