Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB Builder NE   

Variable Arguments Example (Visual Basic)

To create the component for this example, see Passing Variable Arguments. Then create a Microsoft Visual Basic application as follows:

  1. Review the sample application for this example in matlabroot\toolbox\dotnetbuilder\Examples\VS8\NET\VarArgExample
    \VarArgVBApp\VarArgApp.vb
    .

    The program listing is shown here.

     VarArgApp.vb

    The program does the following:

    • Initializes three arrays (colorSpec, data, and coords) using the MWArray class library

    • Creates a Plotter object

    • Calls the extracoords and drawgraph methods

    • Uses MWNumericArray to handle the data needed by the methods

    • Uses a try-catch-finally block to catch and handle any exceptions

    The following statements are alternative ways to call the drawgraph method:

    data = CType(plotter.drawgraph(colorSpec, coords(0), coords(1), coords(2), coords(3), coords(4)), MWNumericArray)
    ...
    data = CType(plotter.drawgraph(colorSpec, coords), MWNumericArray)
  2. Build the VarArgApp application using Visual Studio .NET.

    1. The VarArgVBApp folder contains a Visual Studio .NET project file for this example. Open the project in Visual Studio .NET by double-clicking VarArgVBApp.vbproj in Windows Explorer. You can also open it from the MATLAB desktop by right-clicking VarArgVBApp.vbproj > Open Outside MATLAB.

    2. Add a reference to the MWArray component, which is matlabroot\toolbox\dotnetbuilder\bin\architecture\framework_version
      \mwarray.dll.

    3. If necessary, add (or update the location of) a reference to the VarArgComp component which you built in a previous step. (The component, VarArgComp.dll, is in the \VarArgExample\VarArgComp\x86\V2.0\Debug\distrib subfolder of your work area.)

  3. Build and run the application in Visual Studio .NET.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS