MATLAB BUILDER JA 2 Betriebsanweisung Seite 26

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 292
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 25
1 Getting Started
8 Access the component in a Java application. The sample application for this
example is in
MagicSquareExample\MagicDemoJavaApp\getmagic.java.
getmagic.java
/* getmagic.java
* This file is used as an example for the MATLAB
* Builder for Java product.
*
* Copyright 2001-2006 The MathWorks, Inc.
*/
/* Necessary package imports */
import com.mathworks.toolbox.javabuilder.*;
import magicsquare.*;
/*
* getmagic class computes a magic square of order N. The
* positive integer N is passed on the command line.
*/
class getmagic
{
public static void main(String[] args)
{
MWNumericArray n = null; /* Stores input value */
Object[] result = null; /* Stores the result */
magic theMagic = null; /* Stores magic class instance */
try
{
/* If no input, exit */
if (args.length == 0)
{
System.out.println("Error: must input a positive integer");
return;
}
/* Convert and print input value*/
n = new MWNumericArray(Double.valueOf(args[0]),MWClassID.DOUBLE);
1-18
Seitenansicht 25
1 2 ... 21 22 23 24 25 26 27 28 29 30 31 ... 291 292

Kommentare zu diesen Handbüchern

Keine Kommentare