MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Instrukcja Użytkownika Strona 189

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 408
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 188
Invoking Methods on Java Objects
5-19
Invoking Methods on Java Objects
This section explains how to invoke an object’s methods in MATLAB. It also
covers how to obtain information related to the methods that you’re using and
how MATLAB handles certain types of nonstandard situations.
This section addresses the following topics:
“Using Java and MATLAB Calling Syntax”
“Invoking Static Methods on Java Classes”
“Obtaining Information About Methods”
“Java Methods That Affect MATLAB Commands”
“How MATLAB Handles Undefined Methods”
“How MATLAB Handles Java Exceptions”
Using Java and MATLAB Calling Syntax
To call methods on Java objects, you can use the Java syntax
object.method(arg1,...,argn)
In the following example, frame is the java.awt.Frame object created above,
and
getTitle and setTitle are methods of that object.
frame.setTitle('Sample Frame')
title = frame.getTitle
title =
Sample Frame
Alternatively, you can call Java object (nonstatic) methods with the MATLAB
syntax
method(object, arg1,...,argn)
With MATLAB syntax, the java.awt.Frame example above becomes
setTitle(frame, 'Sample Frame')
Przeglądanie stron 188
1 2 ... 184 185 186 187 188 189 190 191 192 193 194 ... 407 408

Komentarze do niniejszej Instrukcji

Brak uwag