Using Matlab with Pickering PXI Direct IO drivers

    An introduction into how to use the MATLAB programming platform to control Pickering Interfaces' PXI and LXI devices

    Return to Matlab landing page

    As the Pickering drivers are standard Windows dll's, they can be accessed from most programming languages and MATLAB like other programming languages have capability to load and run Pickering drivers to control PXI cards. Functions such as) opening/closing cards(s) and operating switches can be performed using a set of instruction (listed below).

    The functions can either be executed directly on MATLAB workspace or in function (*.m) files.

    Loading Libraries

    To access the library, please use the "loadlibrary" function, here is an example to access the PXI driver PILPXI

    %% Enter appropriate pathname for dll.

    Once the libraries are loaded, in order to check the functions in the library use "libfunctionsview" command followed by the dll's name.

    Lets take an example of PILPXI


    The following window will appear displaying information on functions in external library

    Open Specified Card

    Once the library is loaded, user can now use PIL_OpenSpecifiedCard function to open a specific PXI card in the chassis. This can be achieve by using the "calllib" function as shown in the example below

    %% Create a uint32Ptr to get a return value on logical card number
    cardnum=libpointer('uint32Ptr', 0);
    %% Enter the input parameters for PIPLX_connect
    %% Enter the SessionId obtained when connected to PXI card
    %% Set the BUS and SLOT to the address of the card.
    calllib('Pilpxi', 'PIL_OpenSpecifiedCard', BUS, SLOT, cardnum);
    %% If the ans = 0 (No error returned) the card is successfully opened
    %% Return the value of card number

    Operating Switches

    Once the card is open, user can now able to operate switches. PIL_OpBit allows user to operate switch one at a time. If it's a matrix, please use PIL_OpCrosspoint. Here is an example

    %% Enter the input parameters for PIL_OpBit
    %% OutSub - Output Sub Unit number
    %% BitNum - Output Bit number
    %% state - "1" ON , "0" OFF
    calllib('Pilpxi', 'PIL_OpBit', CardNum, OutSub, BitNum, State); 

    Close Specified Card

    To close a specific card, please use PIL_CloseSpecifiedCard function

    %% Enter the current session ID and card number in the input parameters
    calllib('Pilpxi','PIL_CloseSpecifiedCard', CardNum);

    Unload Libraries

    To unload library use the following command


    Need help?


    Search our knowledgebase for information on software drivers, product comparisons and technical support for our entire product range.

    Knowledgebase Wiki

    Product Selector

    Because we offer such a large range of products, this tool will help you narrow down our offering to get you the correct switch and simulation solution you need.

    Try the selector

    Resource center

    From success stories and product videos,
    to product literature and newsletters, find the information you need about our switching and simulation solutions.

    Get the resources you need

    Worldwide presence

    We supply and support our products across the globe, with seven offices in the Americas, Europe and Asia as well as additional representation. 

    Find a local office or agent near you