0001 function sbi_sensor_check(sqddat,sysids,outfile)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 Nid = length(sysids);
0012
0013 for i = 1:Nid
0014 [okix{i},chname{i},chname0] = readSBI_sensor(sqddat,sysids{i});
0015 end
0016
0017 NsensorAll = 201;
0018 Check = zeros(Nid,NsensorAll);
0019 for i = 1:Nid
0020 Check(i,okix{i}) = 1;
0021 end
0022
0023
0024 Check_R = sum(Check,1);
0025 bad_sensor_ix = find(Check_R>0 & Check_R<Nid);
0026
0027
0028 if ~length(bad_sensor_ix)
0029 disp('Sensors condition is OK over the all sessions.')
0030 return;
0031 end
0032
0033 N_bad_sensor = length(bad_sensor_ix);
0034 Bad_sensor = cell(Nid,1);
0035 for i = 1:N_bad_sensor
0036
0037 session_ix{i} = find(Check(:,bad_sensor_ix(i))==1);
0038
0039 for j = 1:length(session_ix{i})
0040 Bad_sensor{session_ix{i}(j)} =...
0041 [Bad_sensor{session_ix{i}(j)} find(okix{session_ix{i}(j)}==bad_sensor_ix(i) )];
0042 end
0043 end
0044
0045 fprintf('Extra Sensor\n');
0046 for i = 1:Nid
0047 if ~isempty(Bad_sensor{i})
0048 fprintf(['Session ',num2str(i),' : "',sysids{i},'"\n']);
0049 for j = 1:length(Bad_sensor{i})
0050 fprintf(num2str(Bad_sensor{i}(j)));
0051 fprintf('\n');
0052 end
0053 end
0054 end
0055
0056
0057 if nargin==3
0058 fid = fopen(outfile,'w');
0059 for i = 1:Nid
0060 if ~isempty(Bad_sensor{i})
0061 fprintf(fid,['Session ',num2str(i),' : "',sysids{i},'"\n']);
0062 for j = 1:length(Bad_sensor{i})
0063 fprintf(fid,num2str(Bad_sensor{i}(j)));
0064 fprintf(fid,'\n');
0065 end
0066 end
0067 end
0068 fclose(fid);
0069 end