1 | function arplot(varargin) |
---|
2 | %ARPLOT - Read data from archiving database |
---|
3 | % |
---|
4 | % INPUTS |
---|
5 | % 1. attribute name |
---|
6 | % 2. starting date {now - 1 hour} |
---|
7 | % 3. endind date {now} |
---|
8 | % 4. {'HDB'} or 'TDB' : select database |
---|
9 | % |
---|
10 | % EXAMPLES |
---|
11 | % |
---|
12 | % 1. read and plot all dose for the 10 hours |
---|
13 | % arplot('CIGdose') |
---|
14 | % 2. read and plot all dose between two dates |
---|
15 | % arplot('CIGrate', [], '30-09-2005 03:21:02', '30-09-2005 9:21:00') |
---|
16 | % 3. read and plot for moniteur 1 and 4 in list see afterwards |
---|
17 | % arplot('CIGrate', [1;4], '30-09-2005 03:21:02', '30-09-2005 9:21:00') |
---|
18 | % |
---|
19 | % See also arread |
---|
20 | |
---|
21 | % LIN/RP/CIG.001 |
---|
22 | % LT1/RP/CIG.002 |
---|
23 | % BOO-C21/RP/CIG.003 |
---|
24 | % BOO-C04/RP/CIG.004 |
---|
25 | % BOO-C16/RP/CIG.007 |
---|
26 | % BOO-C13/RP/CIG.009 |
---|
27 | % BOO-C16/RP/CIG.010 |
---|
28 | % BOO-C16/RP/CIG.011 |
---|
29 | % BOO-C01/RP/CIG.012 |
---|
30 | % BOO-C12/RP/CIG.026 |
---|
31 | % BOO-C13/RP/CIG.027 |
---|
32 | % BOO-C14/RP/CIG.028 |
---|
33 | % BOO-C15/RP/CIG.029 |
---|
34 | % BOO-C16/RP/CIG.030 |
---|
35 | % |
---|
36 | |
---|
37 | |
---|
38 | % TODO: convertion to Physics units in 'Physics' asked |
---|
39 | % extract the attribute display units |
---|
40 | % To be used |
---|
41 | % rep = uigetdate |
---|
42 | % datestr(rep, 'dd-mm-yyyy HH:MM:SS') |
---|
43 | |
---|
44 | % |
---|
45 | % Written by Laurent S. Nadolski |
---|
46 | |
---|
47 | %% Ask for data |
---|
48 | if nargin == 0 |
---|
49 | fprintf('Provide input argument') |
---|
50 | help arplot; return; |
---|
51 | end |
---|
52 | |
---|
53 | Data = arread(varargin{:}); |
---|
54 | |
---|
55 | if (isnumeric(Data.ardata) && Data == -1) || (~isstruct(Data.ardata) && Data == -1) ... |
---|
56 | || isempty(Data.ardata(1).dvalue) |
---|
57 | disp('No data available') |
---|
58 | return; |
---|
59 | end |
---|
60 | |
---|
61 | % Format for time conversion |
---|
62 | %formatstr0 = 'yyyy-mm-dd HH:MM:SS'; |
---|
63 | % formatstr0 = 'dd-mm-yyyy HH:MM:SS'; |
---|
64 | %formatstr0 = 'dd-mmm-yyyy HH:MM:SS'; |
---|
65 | formatstr = 'HH:MM'; |
---|
66 | |
---|
67 | figure |
---|
68 | h = newplot; |
---|
69 | % set size |
---|
70 | set(gcf,'Position',[80 320 1200 620]) |
---|
71 | xlabel('Time') |
---|
72 | ylabel('Attribut [Harware unit]'); |
---|
73 | hold on; |
---|
74 | grid on; |
---|
75 | |
---|
76 | for ik = 1:length(Data.TangoNames) |
---|
77 | % Time conversion |
---|
78 | % val_date = datenum(datestr(Data.ardata(ik).svalue), formatstr0); |
---|
79 | val_date = Data.ardata(ik).svalue; |
---|
80 | plot(h,val_date,Data.ardata(ik).dvalue,'.-','Color',nxtcolor); |
---|
81 | datetick('x',formatstr); |
---|
82 | end |
---|
83 | |
---|
84 | datalabel on; |
---|
85 | |
---|
86 | title(['Data extracted from ', Data.database, ' database']); |
---|
87 | legend(Data.TangoNames,'Location','EastOutside'); |
---|
88 | addlabel(1,0,['Starting Date : ',datestr(val_date(1),21),' Ending Date : ', datestr(val_date(end),21)]); |
---|
89 | |
---|