No BSD License  

Highlights from
ListBoards

from ListBoards by Richard Medlock
Returns a list of all available boards for a specified adaptor.

ListBoards(Device);
function [BoardNames, BoardIDs,Inputs,Outputs,Both] = ListBoards(Device);

% [BoardNames, BoardIDs,Inputs,Outputs,Both] = LISTBOARDS(Device);
%
% Returns a list of analog input device boards using the specifed device driver.
%
% For example:
%
% >> ListBoards('winsound')
%
% BoardNames = 
%
%           'Creative SoundBlaster PCI'
%           'Midiman Delta AP 1/2'
%           'Midiman Delta AP S/PDIF'
%           'Midiman Delta AP Multichannel'
%           'Midiman Delta AP Mon. Mixer'
%
% BoardIDs =
%
%           0       1       2       3       4
%
%
% Modified 29/05/02: Now also lists Inputs and Outputs Separately...
%
% Inputs =
%
%           0       1       2       3       4
%
% Outputs =
%
%           0       1       2       3
%
% NB: THESE ARE ANALOG CHANNELS ONLY !!
%
% 
% (c) Richard Medlock 2001

%HardwareInfo = daqhwinfo;

ChannelList = cell(4,1);

tempInfo = daqhwinfo(Device);
Boards = tempInfo.InstalledBoardIds;
NumberOfBoards = length(Boards);
AdaptorName = Device;

% NB: There may be some boards that can be used for inputs but not outputs, and
% vice versa. For example, the monitor mixer for the Audiophile is an input only.

i = 0;
inp = 0;
out = 0;
Inputs = [];
Outputs = [];
BoardNames = [];
BoardIDs = [];


for B = 1:NumberOfBoards
    
    BoardID = str2num(Boards{B});
    BoardName = tempInfo.BoardNames{B};
    
    %Need to see if board Supports Analog Input
    
    %AI = 1; AO = 2; DIO = 3;
    
    DIOConstructor = tempInfo.ObjectConstructorName{B,1};
    AI = strfind(DIOConstructor,'analoginput'); %Returns 1 if found
    
    if (~isempty(AI) & AI == 1)
        
        i = i+1;
        
        BoardNames{i} = BoardName;
        BoardIDs(i) = BoardID;
        
    end
    
    if ~isempty(tempInfo.ObjectConstructorName{B,1})
        inp = inp + 1;
        Inputs(inp) = BoardID;
    end
    
    if ~isempty(tempInfo.ObjectConstructorName{B,2})
        out = out + 1;
        Outputs(out) = BoardID;
    end
    
    % Boards that support both input and output...
    Both = Inputs(ismember(Inputs,Outputs));
    
end

Contact us at files@mathworks.com