function [yesRSN,yesMusa] = SWSearch(idTool,conn,FileName) fileID = fopen(FileName,'a'); fmt = '%s \r'; text = 'SWSearch function started'; fprintf(fileID,fmt,text); yesRSN = 0; yesMusa = 0; %% Baro Musa Link comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 41 order by num']; Leggo = fetch(conn,comando); [~,cL] = size(Leggo); if cL > 1 yesMusa = 1; text = 'Baro Musa Links identified, Musa relaunch activated'; fprintf(fileID,fmt,text); end %% Humidity link comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 35 order by num']; Leggo = fetch(conn,comando); [~,cL] = size(Leggo); if cL > 1 yesMusa = 1; text = 'Humidity Links identified, Musa relaunch activated'; fprintf(fileID,fmt,text); end %% CO2 Link comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 33 order by num']; Leggo = fetch(conn,comando); [~,cL] = size(Leggo); if cL > 1 yesMusa = 1; text = 'CO2 Links identified, Musa relaunch activated'; fprintf(fileID,fmt,text); end %% Lux Link comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 34 order by num']; Leggo = fetch(conn,comando); [~,cL] = size(Leggo); if cL > 1 yesMusa = 1; text = 'Lux Links identified, Musa relaunch activated'; fprintf(fileID,fmt,text); end %% RSN Link comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 38 order by num']; Leggo = fetch(conn,comando); [~,cL] = size(Leggo); if cL > 1 yesRSN = 1; text = 'RSN Links identified, RSN relaunch activated'; fprintf(fileID,fmt,text); end %% RSN Link HR comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 39 order by num']; Leggo = fetch(conn,comando); [~,cL] = size(Leggo); if cL > 1 yesRSN = 1; text = 'RSN Links HR identified, RSN relaunch activated'; fprintf(fileID,fmt,text); end %% Trigger Link comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 40 order by num']; curs = exec(conn,comando); curs = fetch(curs); Leggo = curs.Data; [~,cL] = size(Leggo); if cL > 1 yesRSN = 1; text = 'Trigger Links identified, RSN relaunch activated'; fprintf(fileID,fmt,text); end %% G-Flow Link comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 48 order by num']; curs = exec(conn,comando); curs = fetch(curs); Leggo = curs.Data; [~,cL] = size(Leggo); if cL > 1 yesRSN = 1; text = 'G-Flow Links identified, RSN relaunch activated'; fprintf(fileID,fmt,text); end %% G-Shock Link comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 50 order by num']; curs = exec(conn,comando); curs = fetch(curs); Leggo = curs.Data; [~,cL] = size(Leggo); if cL > 1 yesRSN = 1; text = 'G-Shock Links identified, RSN relaunch activated'; fprintf(fileID,fmt,text); end %% Debris Link comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 49 order by num']; curs = exec(conn,comando); curs = fetch(curs); Leggo = curs.Data; [~,cL] = size(Leggo); if cL > 1 yesRSN = 1; text = 'Debris Links identified, RSN relaunch activated'; fprintf(fileID,fmt,text); end text = 'SWScheme function ended'; fprintf(fileID,fmt,text); fclose(fileID); end