| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB Builder NE |
| Contents | Index |
| Learn more about MATLAB Builder NE |
To create the component for this example, see the first few steps of the Spectral Analysis Example. Then create a Microsoft Visual Basic application as follows:
Review the sample application for this example in matlabroot\toolbox\dotnetbuilder\Examples\VS8\NET\SpectraVBApp\SpectraApp.vb.
The program listing is shown here.
The program does the following:
Constructs an input array with values representing a random signal with two sinusoids at 15 and 40 Hz embedded inside of it
Uses MWNumericArray to handle data conversion
Note For complete reference information about the MWArray class hierarchy, see the MWArray Class Library Reference (available online only). |
Instantiates a SignalAnalyzer object
Calls the computefft method, which computes the FFT, frequency, and the spectral density
Instantiates a Plotter object
Calls the plotfft method, which plots the data
Uses a try/catch block to handle exceptions
The following statements
Dim data As MWNumericArray = New MWNumericArray_
(MWArrayComplexity.Real, MWNumericType.Double, numSamples)
...
Dim resultArray As MWNumericArray = New MWNumericArray_
(MWArrayComplexity.Complex, MWNumericType.Double, numElements)
show how to use the MWArray class library to construct the necessary data types.
The following statement
Dim signalAnalyzer As SignalAnalyzer = New SignalAnalyzer
creates an instance of the class SignalAnalyzer, and the following statement
Dim argsOut() As MWArray = signalAnalyzer.computefft
(3, data, MWArray.op_Implicit(interval))
calls the method computefft and request three outputs.
Build the SpectraApp application using Visual Studio .NET.
The SpectraVBApp folder contains a Visual Studio .NET project file for this example. Open the project in Visual Studio .NET by double-clicking SpectraVBApp.vbproj in Windows Explorer. You can also open it from the MATLAB desktop by right-clicking SpectraVBApp.vbproj > Open Outside MATLAB.
Add a reference to the MWArray component,
which is matlabroot\toolbox\dotnetbuilder\bin\architecture\framework_version
\mwarray.dll.
If necessary, add (or update the location of) a reference to the SpectraComp component which you built in a previous step. (The component, SpectraComp.dll, is in the \SpectraExample\SpectraComp\x86\V2.0\Debug\distrib subfolder of your work area.)
Build and run the application in Visual Studio .NET.
![]() | Variable Arguments Example (Visual Basic) | Matrix Math Example (Visual Basic) | ![]() |

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 |