source: trunk/src/num2stra.m @ 871

Last change on this file since 871 was 809, checked in by g7moreau, 10 years ago
  • Add license
File size: 1.9 KB
RevLine 
[8]1%'num2stra': transform number to the corresponding character string depending on the nomenclature
2%--------------------------------------------
3% function str=num2stra(num,nom_type)
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%
12% see also: stra2num, name_generator, name2display
13
[809]14%=======================================================================
15% Copyright 2008-2014, LEGI UMR 5519 / CNRS UJF G-INP, Grenoble, France
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]32function str=num2stra(num,nom_type,index)
[332]33str='';
[8]34if ~exist('index','var')
35    index=2; %index 1 or 2 of the file indices
36end
37switch 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]52end
Note: See TracBrowser for help on using the repository browser.