function err=closeAllPorts()
% closeAllPort <Close serial ports using instrfind.>
% Usage:: s=closeAllPort()
%

% revision history:
% 02/28/21 Mark D. Shattuck <mds> closeAllPort.m

%% Main
err=0;
s=instrfind;
if(isempty(s))
  fprintf('No open ports found.\n');
  err=-1;
else
  fclose(s);
  delete(s);
  fprintf('Ports closed.\n');
end


