You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: deviceExists.m
    path of file: ./repos/MATLAB_DAQmx_examples/code/+nidaqmx
    
    the code of the file until where you have to start completion: function devExists = deviceExists(devID)
% Return true if an NI device of a given name is connected
%
% function devExists = nidaqmx.deviceExists(devID)
%
% Purpose
% Returns true if DAQmx reports that a device called devID is attached to the PC.
% If the device is not present, false is returned.
%
% Inputs
% devID - String defining the name of the device to search for. e.g. 'Dev1'
%
% Outputs
% devExists - true if device exists
%
%
% Rob Campbell - SWC 2022

    
function devExists = deviceExists(devID)
% Return true if an NI device of a given name is connected
%
% function devExists = nidaqmx.deviceExists(devID)
%
% Purpose
% Returns true if DAQmx reports that a device called devID is attached to the PC.
% If the device is not present, false is returned.
%
% Inputs
% devID - String defining the name of the device to search for. e.g. 'Dev1'
%
% Outputs
% devExists - true if device exists
%
%
% Rob Campbell - SWC 2022


devExists = false;

try
    connectedDevices = nidaqmx.listDevices;
catch
    fprintf('Failed to read connected NI devices\n')
    return
end