[8] | 1 | %'num2stra': transform number to the corresponding character string depending on the nomenclature
|
---|
| 2 | %--------------------------------------------
|
---|
[874] | 3 | % function str=num2stra(num,nom_type,index)
|
---|
[8] | 4 | %
|
---|
| 5 | % OUTPUT:
|
---|
| 6 | % str: character string
|
---|
| 7 | %
|
---|
| 8 | % INPUT:
|
---|
| 9 | % num: input number (file index)
|
---|
| 10 | % nom_type: nomencalture type (see fct name_generator)
|
---|
[874] | 11 | % index: 1 or 2 (first or secodn index in file naming)
|
---|
[8] | 12 | % see also: stra2num, name_generator, name2display
|
---|
| 13 |
|
---|
[809] | 14 | %=======================================================================
|
---|
[1107] | 15 | % Copyright 2008-2022, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
|
---|
[809] | 16 | % http://www.legi.grenoble-inp.fr
|
---|
| 17 | % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
|
---|
| 18 | %
|
---|
| 19 | % This file is part of the toolbox UVMAT.
|
---|
| 20 | %
|
---|
| 21 | % UVMAT is free software; you can redistribute it and/or modify
|
---|
| 22 | % it under the terms of the GNU General Public License as published
|
---|
| 23 | % by the Free Software Foundation; either version 2 of the license,
|
---|
| 24 | % or (at your option) any later version.
|
---|
| 25 | %
|
---|
| 26 | % UVMAT is distributed in the hope that it will be useful,
|
---|
| 27 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 28 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 29 | % GNU General Public License (see LICENSE.txt) for more details.
|
---|
| 30 | %=======================================================================
|
---|
| 31 |
|
---|
[122] | 32 | function str=num2stra(num,nom_type,index)
|
---|
[332] | 33 | str='';
|
---|
[8] | 34 | if ~exist('index','var')
|
---|
| 35 | index=2; %index 1 or 2 of the file indices
|
---|
| 36 | end
|
---|
| 37 | switch index
|
---|
| 38 | case 1
|
---|
[332] | 39 | % if length(nom_type)>=4 && isequal(nom_type(1:2),'%0') && isequal(nom_type(4),'d')
|
---|
| 40 | % str=num2str(num,nom_type(1:4));
|
---|
| 41 | % else
|
---|
[8] | 42 | str=num2str(num);
|
---|
[332] | 43 | % end
|
---|
[8] | 44 | case 2
|
---|
[371] | 45 | if ~isempty(nom_type) && (isequal(nom_type(end),'a')||isequal(nom_type(end),'b'))
|
---|
[8] | 46 | str=char(96+num);
|
---|
[371] | 47 | elseif ~isempty(nom_type) && (isequal(nom_type(end),'A')||isequal(nom_type(end),'B'))
|
---|
[8] | 48 | str=char(64+num);
|
---|
| 49 | else
|
---|
| 50 | str=num2str(num);
|
---|
| 51 | end
|
---|
[809] | 52 | end
|
---|