Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
17
Добавлен:
09.02.2015
Размер:
336.38 Кб
Скачать

Is the Java class specified by the character string classname.

Examples

% create a 10-element java.awt.Frame Java array

ja = javaArray('java.awt.Frame',10);

% create a 5x10x2 java.lang.Double Java array

ja = javaArray('java.lang.Double',5,10,2);

Reference page in Help browser

doc javaArray

<javaMethod> - Invoke a Java method.

javaMethod Invoke a Java method letting MATLAB choose the thread.

javaMethod is used to invoke either static or non-static Java

methods. Typically, MATLAB invokes methods on Java objects from the main

MATLAB thread. The primary exceptions are if the class is an instance of

com.mathworks.jmi.ComponentBridge or the object was created with

javaObjectEDT. To invoke methods on subclasses of java.awt.Component, use

javaObjectEDT.

If M is a string containing the name of a Java method, and C is a string

containing the name of a Java class, then

javaMethod(M,C,x1,...,xn)

invokes the Java method M in the class C with the signature matching the

arguments x1,...,xn. For example,

javaMethod('isNaN', 'java.lang.Double', x)

invokes the static Java method isNaN in class java.lang.Double.

If J is a Java object array, then javaMethod(M,J,x1,...,xn) invokes the

non-static Java method M in the class of J with the signature matching

the arguments x1,...,xn. For example, if V is a java.util.Vector Java

object array, then

V = java.util.Vector;

javaMethod('setSize', V, 10)

sets the size of the vector. javaMethod is not normally needed or used

in this form. The usual way to invoke Java methods on a Java object is

by the MATLAB method invocation syntax, such as setSize(V, 10), or the

Java invocation syntax, such as V.setSize(10). javaMethod is provided

for those instances when the normal method invocation syntax cannot be

used (such as when complete control is required).

See also javaObject, import, methods, isjava.

Reference page in Help browser

doc javaMethod

<javaObject> - Invoke a Java object constructor.

javaObject Invoke a Java object constructor letting MATLAB choose the thread.

javaObject is used to construct a Java Object. Typically, MATLAB constructs

Java objects from the main MATLAB thread. The primary exception is if the

class is an instance of com.mathworks.jmi.ComponentBridge. To construct a

subclasses of java.awt.Component, use javaObjectEDT.

If C is a string containing the name of a Java class, then

javaObject(C,x1,...,xn)

invokes the Java constructor for class C with the signature

matching the arguments x1,...,xn. The resulting Java object

is returned as a Java object array.

For example,

X = javaObject('java.awt.Color', 0.1, 0, 0.7)

constructs and returns a java.awt.Color object array.

If a constructor matching the specified class and signature does

not exist, an error will occur.

javaObject will not normally be needed or used; the usual way

to invoke Java constructors is by the MATLAB constructor syntax,

such as X = java.awt.Color(0.1, 0, 0.7). javaObject is provided

for those instances that the MATLAB constructor syntax cannot be

used (such as when class parametric object construction is

required).

See also javaMethod, import, methods, isjava.

Reference page in Help browser

doc javaObject

<javaMethodEDT> - Invoke a Java method on the Swing Event Dispatch Thread.

javaMethodEDT Invoke a Java method from the Event Dispatch Thread (EDT).

javaMethodEDT is used to invoke either static or non-static Java methods

from the Swing Event Dispatch Thread (EDT).

If M is a string containing the name of a Java method, and C is a

string containing the name of a Java class, then

javaMethodEDT(M,C,x1,...,xn)

invokes the Java method M in the class C with the signature matching

the arguments x1,...,xn from the Event Dispatch Thread (EDT).

For example,

javaMethodEDT('setDefaultLookAndFeelDecorated', 'javax.swing.JFrame', true)

invokes the static Java method setDefaultLookAndFeelDecorated in

class javax.swing.JFrame from the Event Dispatch Thread (EDT).

If J is a Java object array, then

javaMethodEDT(M,J,x1,...,xn)

invokes the non-static Java method M in J with the signature matching

the arguments x1,...,xn from the Event Dispatch Thread (EDT). This form of the

function would be needed to invoke a method on the EDT if the object

was not previously "tagged" using javaObjectEDT. For example,

v = java.util.Vector;

javaMethodEDT('add',v,'string');

creates a Vector v on the MATLAB thread and invokes v.add('string')

from the Event Dispatch Thread (EDT).

See also javaMethod, javaObject, javaObjectEDT, import, methods, isjava.

Reference page in Help browser

doc javaMethodEDT

<javaObjectEDT> - Invoke a Java object constructor on the Swing Event Dispatch Thread.

javaObjectEDT Invoke a Java object constructor and subsequent methods on the Event Dispatch Thread (EDT).

This function can also tag an already existing object so that any future

method invocations on the object are dispatched from the EDT.

If C is a string containing the name of a Java class, then

javaObjectEDT(C,x1,...,xn)

invokes the Java constructor for class C with the signature matching the

arguments x1,...,xn from the Swing Event Dispatch Thread (EDT). The

resulting Java object is returned as a Java object array. All subsequent

methods invoked on the returned object will be dispatched from the EDT.

For example,

f = javaObjectEDT('javax.swing.JFrame', 'New Title')

constructs and returns a javax.swing.JFrame object array from the

Event Dispatch Thread (EDT).

If passed an existing Java object array, all subsequent methods invoked

on the object will be dispatched from the EDT.

Static methods on the specified class or Java object are not affected.

They always run on the MATLAB thread unless invoked using javaMethodEDT.

For example,

% Create a JOption pane on the EDT

optPane = javaObjectEDT('javax.swing.JOptionPane');

% Call the createDialog method - this is automatically done on the EDT

dlg = optPane.createDialog([],'Sample Dialog');

% Tell MATLAB to dispatch methods on dlg from the EDT

javaObjectEDT(dlg);

See also javaMethod, javaObject, javaMethodEDT, import, methods, isjava.

Reference page in Help browser

doc javaObjectEDT

<cast> - Cast a variable to a different data type or class.

CAST Cast a variable to a different data type or class.

B = CAST(A,NEWCLASS) casts A to class NEWCLASS. A must be convertible to class NEWCLASS. NEWCLASS must be the name of one of the builtin data types.

Example:

a = int8(5);

b = cast(a,'uint8');

See also class.

Overloaded methods:

codistributed/cast

Reference page in Help browser

doc cast

Class determination functions

<isnumeric> - True for numeric arrays.

ISNUMERIC True for numeric arrays.

ISNUMERIC(A) returns true if A is a numeric array and false otherwise.

For example, integer and float (single and double) arrays are numeric,

while logicals, strings, cell arrays, and structure arrays are not.

Example:

isnumeric(pi)

returns true since pi has class double while

isnumeric(true)

returns false since true has data class logical.

See also isa, double, single, isfloat, isinteger, issparse, islogical, ischar.

Reference page in Help browser

doc isnumeric

<isfloat> - True for floating point arrays, both single and double.

ISFLOAT True for floating point arrays, both single and double.

ISFLOAT(A) returns true if A is a floating point array and false otherwise.

Single and double are the only floating point data types in MATLAB.

Example:

isfloat(single(pi))

returns true since single is floating point data type while

isfloat(int8(3))

returns false since int8 is not a floating point data type.

See also isa, double, single, isnumeric, isinteger.

Reference page in Help browser

doc isfloat

<isinteger> - True for arrays of integer data type.

ISINTEGER True for arrays of integer data type.

ISINTEGER(A) returns true if A is an array of integer data type and false

otherwise.

The 8 integer data types in MATLAB are int8, uint8, int16, uint16,

int32, uint32, int64 and uint64.

Example:

isinteger(int8(3))

returns true because int8 is a valid integer data type but

isinteger (3)

returns false since the constant 3 is actually a double as is shown by

class(3)

See also isa, isnumeric, isfloat.

Reference page in Help browser

doc isinteger

<islogical> - True for logical array.

ISLOGICAL True for logical array.

ISLOGICAL(X) returns true if X is a logical array and false otherwise.

Logical arrays must be used to perform logical 0-1 indexing.

The result of calling ISLOGICAL(X) is the same as calling ISA(X, 'logical').

Reference page in Help browser

doc islogical

<iscom> - true for COM/ActiveX objects.

ISCOM true for COM/ActiveX objects.

ISCOM(H) returns true if H is a COM/ActiveX object, false otherwise.

Example:

h=actxcontrol('mwsamp.mwsampctrl.2');

ret = iscom(h)

See also isinterface, isobject, actxcontrol, actxserver.

Reference page in Help browser

doc iscom

<isinterface> - true for COM Interfaces.

ISINTERFACE true for COM Interfaces.

ISINTERFACE(H) returns true if H is a COM Interface, false otherwise.

Example:

h = actxserver('excel.application');

workbooks = get(h, 'workbooks');

ret = isinterface(workbooks);

See also iscom, isobject, actxcontrol, actxserver.

Reference page in Help browser

doc isinterface

Соседние файлы в папке Библиотеки Matlab