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 |
|
---|
14 | function str=num2stra(num,nom_type,index)
|
---|
15 | if ~exist('index','var')
|
---|
16 | index=2; %index 1 or 2 of the file indices
|
---|
17 | end
|
---|
18 | switch index
|
---|
19 | case 1
|
---|
20 | if length(nom_type)>=4 && isequal(nom_type(1:2),'%0') && isequal(nom_type(4),'d')
|
---|
21 | str=num2str(num,nom_type(1:4));
|
---|
22 | else
|
---|
23 | str=num2str(num);
|
---|
24 | end
|
---|
25 | case 2
|
---|
26 | if isempty(nom_type)
|
---|
27 | nom_type='none';
|
---|
28 | end
|
---|
29 | if isequal(nom_type,'png_old') || isequal(nom_type,'netc_old') || isequal(nom_type,'raw_SMD')||...
|
---|
30 | isequal(nom_type(end),'a')||isequal(nom_type(end),'b')
|
---|
31 | str=char(96+num);
|
---|
32 | elseif isequal(nom_type(end),'A')|isequal(nom_type(end),'B')
|
---|
33 | str=char(64+num);
|
---|
34 | elseif isequal(nom_type,'series_i')|isequal(nom_type,'netc_series')...
|
---|
35 | |isequal(nom_type,'ima_num')| isequal(nom_type,'avi')| isequal(nom_type,'none')...
|
---|
36 | isequal(nom_type,'_i')|isequal(nom_type,'_i1-i2')
|
---|
37 | str='';
|
---|
38 | else
|
---|
39 | str=num2str(num);
|
---|
40 | end
|
---|
41 | end |
---|