MATLAB BUILDER JA 2 User's Guide Page 232

  • Download
  • Add to my manuals
  • Print
  • Page
    / 292
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 231
5 Sample Applications (Java)
Plot Example
The purpose of the example is to show you how to do the following:
UseMATLABBuilderforJavatoconvertaMATLABfunction(
drawplot)
to a m ethod of a Java class (
plotter) and wrap the class in a Java
component (
plotdemo).
Access the component in a Java application (
createplot.java)by
instantiating the
plotter class and using the MWArray class library to
handle data conversion.
Note For complete reference inform atio n about the MWArray class
hierarchy, see the
com.mathworks.toolbox.javabuilder package.
Build and run the createplot.java application.
The
drawplot function displays a plot of input parameters x and y.
Plot Example: Step-by-Step Procedure
1 Ifyouhavenotalreadydoneso,copythefilesforthisexampleasfollows:
a. Copy the following directory that ships with MATLAB to your work
directory:
matlabroot\t
oolbox\javabuilder\Examples\PlotExample
b. At the M ATLAB command prompt, cd to the new PlotExample
subdirectory in your w ork directory.
2 If you have not
already done so, set the environment variables that are
required on a d
evelopment machine. See “Settings for Environment
Variables (De
velopment Machine)” on page 6-2.
3 Write the drawplot function as you w ould any MATLAB function.
The following code defines the
drawplot function:
function drawplot(x,y)
5-2
Page view 231
1 2 ... 227 228 229 230 231 232 233 234 235 236 237 ... 291 292

Comments to this Manuals

No comments