forked from BUNPC/ninjaGUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ninjaGUI.m
48 lines (44 loc) · 1.28 KB
/
ninjaGUI.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
46
47
48
function ninjaGUI(fname)
%Routine to check initial configuration of the fNIRS device and launch the
%startup sequence
if nargin==0
[fname,path]=uigetfile({'*.cfg', 'Hardware configuration file (*.cfg)'});
fname=[path,filesep,fname];
if ~fname
disp('No file selected, defaulting to fNIRS.cfg')
fname='fNIRS.cfg';
end
elseif length(fname)<4
fname = strcat(fname,'.cfg');
elseif ~strcmp(fname(end-3:end),'.cfg')
fname = strcat(fname,'.cfg');
end
%set path to functions
addpath(genpath('device_functions'))
%% check existence of of cfg
disp(['Looking for ',fname,'...'])
if exist(fname,'file')
disp(['Loading ',fname,'...'])
[devinfo,error]=loadCFG(fname);
if error
disp([filename, ' corrupt, starting configuration dialog'])
okflag=0;
else
okflag=1;
end
else
disp([fname ' not found, starting configuration dialog'])
okflag=0;
end
if okflag
%call set environment function with devinfo input
disp('Setting environment')
environment=setEnv(devinfo);
disp('Starting NIRS application')
%start main app with environment input
fNIRSapp(devinfo,environment)
%disp('Success')
else
%start configuration dialog
hardwareselect()
end