1 | %'num2stra': transform number to the corresponding character string depending on the nomenclature
|
---|
2 | %--------------------------------------------
|
---|
3 | % function str=num2stra(num,nom_type,index)
|
---|
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)
|
---|
11 | % index: 1 or 2 (first or secodn index in file naming)
|
---|
12 | % see also: stra2num, name_generator, name2display
|
---|
13 |
|
---|
14 | %=======================================================================
|
---|
15 | % Copyright 2008-2024, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
|
---|
16 | % http://www.legi.grenoble-inp.fr
|
---|
17 | % Joel.Sommeria - Joel.Sommeria (A) univ-grenoble-alpes.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 |
|
---|
32 | function str=num2stra(num,nom_type,index)
|
---|
33 | str='';
|
---|
34 | if ~exist('index','var')
|
---|
35 | index=2; %index 1 or 2 of the file indices
|
---|
36 | end
|
---|
37 | switch index
|
---|
38 | case 1
|
---|
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
|
---|
42 | str=num2str(num);
|
---|
43 | % end
|
---|
44 | case 2
|
---|
45 | if ~isempty(nom_type) && (isequal(nom_type(end),'a')||isequal(nom_type(end),'b'))
|
---|
46 | str=char(96+num);
|
---|
47 | elseif ~isempty(nom_type) && (isequal(nom_type(end),'A')||isequal(nom_type(end),'B'))
|
---|
48 | str=char(64+num);
|
---|
49 | else
|
---|
50 | str=num2str(num);
|
---|
51 | end
|
---|
52 | end
|
---|