⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 findimaqdevices.m

📁 利用matlab编了一个pendulum仿真的例子
💻 M
字号:
function devInfo = FindImaqDevices(desiredFormat)
%FINDIMAQDEVICES returns list of available image acquisition devices.
%   DEVINFO = FINDIMAQDEVICES returns a structure array with named fields.
%     .NAME is good for populating a GUI for user selection.
%     .CONSTRUCTOR aids programmatic connection to each device.
%     .ADAPTOR and .DEVICE help with nondefault object constructors.
%   The length of DEVINFO indicates how many devices detected.  
%   If no devices detected, DEVINFO is empty.
%
%   DEVINFO = FINDIMAQDEVICES(DESIREDFORMAT) allows specification of the
%   desired video format. This string is inserted into the constructor
%   field for each device. DESIREDFORMAT is not checked, so if you specify
%   an invalid format then evaluating the constructor(s) will error.
%
%   NOTE: This function calls IMAQRESET, which closes and deletes any
%   previously active videoinput objects.
%
%   See also FINDCAM, IMAQHWINFO, IMAQRESET.

error(nargchk(0,1,nargin))
error(nargoutchk(1,1,nargout))

%make sure recently added plug-n-play devices also detectable
imaqreset

%installed adaptors
hwInfo = imaqhwinfo;
adaptors = hwInfo.InstalledAdaptors;

%available devices
numDevices = 0;  %start with empty list
for i=1:length(adaptors)  %check each adaptor
  adaptorInfo = imaqhwinfo(adaptors{i});
  devices = adaptorInfo.DeviceIDs;
  %add each device to list
  for j=1:length(devices)
    numDevices = numDevices+1;
    deviceInfo = imaqhwinfo(adaptors{i},devices{j});
    devInfo(numDevices).name = deviceInfo.DeviceName;
    constructor = deviceInfo.ObjectConstructor;
    if nargin>0  %add format to object constructor
      constructor = [constructor(1:end-1) ', ''' desiredFormat ''')'];
    end
    devInfo(numDevices).constructor = constructor;
    devInfo(numDevices).adaptor = adaptors{i};
    devInfo(numDevices).device = devices{j};
  end  %for j = devices
end  %for i = adaptors

%return empty idicator if no devices detected
if numDevices==0
  devInfo=[];
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -