-
Notifications
You must be signed in to change notification settings - Fork 0
/
setTimeAMS.m
45 lines (40 loc) · 1.11 KB
/
setTimeAMS.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Filename: setTimeAMS.m
%
% Copyright: A-M Systems
%
% Author: DHM
%
% Description:
% This is a MATLAB script that takes a Model 4100 time value and converts
% it into a decimal string from 0.000 to 90,000,000.000.
%
% Ensure that the location of this file is in your MATLAB Path.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function setTimeAMS(hObject, val)
h=guidata(hObject); %get graphic data
bntData=get(hObject,'UserData');
% UserData= name, type, myValue, previous_value_from_instrument
btnName=cell2mat(bntData(1));
% cntlType=cell2mat(bntData(2));
% myValue=cell2mat(bntData(3));
% pVal=cell2mat(bntData(4));
val=val/1000;
switch btnName
case 'EventDur1'
if val < .001
val=.001;
end
case {'EventPeriod', 'TrainDur', 'TrainPeriod'}
if val < .002
val=.002;
end
otherwise
if val < 0
val=0;
end
end
set(h.(bntName),'Value', num2str( val ));
end