Skey = 'HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM'; % Find connected serial devices and clean up the output [~, list] = dos(['REG QUERY ' Skey]); list = strread(list,'%s','delimiter',' '); coms = 0; for i = 1:numel(list) if strcmp(list{i}(1:3),'COM') if ~iscell(coms) coms = list(i); else coms{end+1} = list{i}; end end end key = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\'; % Find all installed USB devices entries and clean up the output [~, vals] = dos(['REG QUERY ' key ' /s /f "FriendlyName" /t "REG_SZ"']); vals = textscan(vals,'%s','delimiter','\t'); vals = cat(1,vals{:}); out = 0; % Find all friendly name property entries for i = 1:numel(vals) if strcmp(vals{i}(1:min(12,end)),'FriendlyName') if ~iscell(out) out = vals(i); else out{end+1} = vals{i}; end end end % Compare friendly name entries with connected ports and generate output for i = 1:numel(coms) match = strfind(out,[coms{i},')']); ind = 0; for j = 1:numel(match) if ~isempty(match{j}) ind = j; end end if ind ~= 0 com = str2double(coms{i}(4:end)); % Trim the trailing ' (COM##)' from the friendly name - works on ports from 1 to 99 if com > 9 length = 8; else length = 7; end devs{i,1} = out{ind}(27:end-length); devs{i,2} = com; end end
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.