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

Value arrays are placed into corresponding structure array elements.

The size of the resulting structure is the same size as the value

cell arrays or 1-by-1 if none of the values is a cell.

STRUCT(OBJ) converts the object OBJ into its equivalent

structure. The class information is lost.

STRUCT([]) creates an empty structure.

To create fields that contain cell arrays, place the cell arrays

within a VALUE cell array. For instance,

s = struct('strings',{{'hello','yes'}},'lengths',[5 3])

creates the 1-by-1 structure

s =

strings: {'hello' 'yes'}

lengths: [5 3]

Example

s = struct('type',{'big','little'},'color','red','x',{3 4})

See also isstruct, setfield, getfield, fieldnames, orderfields,

isfield, rmfield, deal, substruct, struct2cell, cell2struct.

Overloaded methods:

memmapfile/struct

network/struct

SimData/struct

Reference page in Help browser

doc struct

<methods> - Display class method names.

METHODS Display class method names.

METHODS CLASSNAME displays the names of the methods for the

class with the name CLASSNAME.

METHODS(OBJECT) displays the names of the methods for the

class of OBJECT.

M = METHODS(...) returns the method names in a cell array

of strings.

If CLASSNAME represents a MATLAB or Java class, then only

public methods are returned, including those inherited

from base classes.

METHODS differs from WHAT in that the methods from all method

directories are reported together, and METHODS removes all

duplicate method names from the result list.

METHODS CLASSNAME -full displays a full description of the

methods in the class, including inheritance information and,

for MATLAB and Java methods, method attributes and signatures.

Duplicate method names with different signatures are not

removed.

M = METHODS( ..., '-full') returns the full method descriptions

In a cell array of strings.

The word METHODS is also used in a MATLAB class definition to

denote the start of a methods definition block.

Examples:

%Example 1:

%Retrieve the names of the public methods of class 'memmapfile'

%and capture the result in a cell array of strings.

methodnames = methods('memmapfile');

%Example 2:

%Construct a java.lang.String instance and display the names of

%the public methods of that instance.

s = java.lang.String;

methods(s);

See also methodsview, properties, events, classdef, what, which.

Overloaded methods:

serial/methods

icinterface/methods

imaqdevice/methods

imaqchild/methods

iviconfigurationstore/methods

icgroup/methods

icdevice/methods

Reference page in Help browser

doc methods

<methodsview> - View names and properties of class methods.

METHODSVIEW View the methods for a class.

METHODSVIEW(CLASSNAME) displays the methods of a class along with

the properties of each method.

METHODSVIEW(OBJECT) displays the methods of OBJECT's class along

with the properties of each method.

METHODSVIEW is a visual representation of the information returned

by methods -full.

Examples

methodsview java.lang.Double;

See also methods, what, which, help.

Reference page in Help browser

doc methodsview

<properties> - Display class property names.

PROPERTIES Display class property names.

PROPERTIES CLASSNAME displays the names of the public

properties for the MATLAB class with the name CLASSNAME,

including public properties inherited from base classes.

PROPERTIES(OBJECT) displays the names of the public

properties for the class of OBJECT, where OBJECT is an

instance of a MATLAB class. OBJECT can be either a scalar

object or an array of objects. When OBJECT is scalar,

dynamic properties are also returned.

P = PROPERTIES(...) returns the property names in a cell

array of strings. The workspace browser can be used to

browse current values of properties.

A property is public when its GetAccess attribute is set to

Public and its Hidden attribute is set to false (the default

values for these attributes).

PROPERTIES differs from FIELDNAMES in that PROPERTIES accepts

a class name as an input argument.

The word PROPERTIES is also used in a MATLAB class definition

to denote the start of a properties definition block.

Examples:

%Example 1:

%Retrieve the names of the public properties of class 'memmapfile'

%and store the result in a cell array of strings.

propnames = properties('memmapfile');

%Example 2:

%Construct an MException instance and request the properties

%of that instance.

e = MException('Msg:ID','MsgText');

properties(e)

See also fieldnames, methods, events, classdef.

Overloaded methods:

contwostage/properties

conswitch/properties

constar/properties

conrange/properties

conellipsoid/properties

conconvexhull/properties

conbase/properties

xregbdryroot/properties

xregbdrynode/properties

xregbdrydev/properties

Reference page in Help browser

doc properties

<events> - Display class event names.

EVENTS Display class event names.

EVENTS CLASSNAME displays the names of the public events for

the MATLAB class with the name CLASSNAME, including those

inherited from base classes.

EVENTS(OBJECT) displays the names of the public events for the

class of OBJECT, where OBJECT is an instance of a MATLAB class.

OBJECT may be either a scalar object or an array of objects.

E = EVENTS(...) returns the event names in a cell array of

strings.

The word EVENTS is also used in a MATLAB class definition to

denote the start of an events definition block.

%Example:

%Retrieve the names of the public events of class 'handle'

%and store the result in a cell array of strings.

eventnames = events('handle');

See also properties, methods, classdef.

Overloaded methods:

COM/events

Reference page in Help browser

doc events

<enumeration> - Display class enumerated value names.

ENUMERATION Display class enumeration member and names.

ENUMERATION CLASSNAME displays the names of the enumeration members for the MATLAB class with the name CLASSNAME.

ENUMERATION(OBJECT) displays the names of the enumeration members for the class of OBJECT.

M = ENUMERATION(...) returns the enumeration members for the class in

the column vector M of objects.

[M, S] = ENUMERATION(...) returns the names of the enumeration members

in the cell array of strings S. The names in S correspond element-

wise to the enumeration members in M.

If an enumeration is derived from a built-in class it may specify more

than one name for a given enumeration member. When you call the

ENUMERATION function with no output arguments, MATLAB displays only the first name for each member (as specified in the class definition). To

see all available enumeration members and their names, use the two-

output form [M, S] = ENUMERATION(...).

Examples based on the following enumeration class:

classdef Boolean < logical

enumeration

No(0)

Yes(1)

Off(0)

On(1)

end

end

%Example 1: Display the names of the enumeration members for

%class 'Boolean':

enumeration Boolean;

%Example 2: Get the enumeration members for class 'Boolean'

%in a column vector of objects:

e = Boolean.Yes;

members = enumeration(e);

%Example 3: Get all available enumeration members and their names:

[members, names] = enumeration('Boolean');

See also classdef.

Reference page in Help browser

doc enumeration

<superclasses> - Display names of the superclasses of a given class.

SUPERCLASSES Display superclass names.

SUPERCLASSES CLASSNAME displays the names of all visible superclasses

of the MATLAB class with the name CLASSNAME. Visible classes are those

with class attribute Hidden set to false (the default).

SUPERCLASSES(OBJECT) displays the names of the visible superclasses for

the class of OBJECT, where OBJECT is an instance of a MATLAB class.

OBJECT can be either a scalar object or an array of objects.

S = SUPERCLASSES(...) returns the superclass names in a cell array of

strings.

%Example:

%Retrieve the names of the visible superclasses of class

%AbstractFileDialog and store the result in a cell array of strings.

classnames = superclasses('AbstractFileDialog');

See also properties, methods, events, classdef.

Reference page in Help browser

doc superclasses

<isa> - True if object is a given class.

ISA True if object is a given class.

ISA(OBJ,'classname') returns true if OBJ is an instance of 'classname'.

It also returns true if OBJ is an instance of a class that is derived

from 'classname'.

Some possibilities for 'classname' are:

double -- Double precision floating point numeric array

(this is the traditional MATLAB matrix or array)

logical -- Logical array

char -- Character array

single -- Single precision floating-point numeric array

float -- Double or single precision floating-point numeric array

int8 -- 8-bit signed integer array

uint8 -- 8-bit unsigned integer array

int16 -- 16-bit signed integer array

uint16 -- 16-bit unsigned integer array

int32 -- 32-bit signed integer array

uint32 -- 32-bit unsigned integer array

int64 -- 64-bit signed integer array

uint64 -- 64-bit unsigned integer array

integer -- An array of any of the 8 integer classes above

numeric -- Integer or floating-point array

cell -- Cell array

struct -- Structure array

function_handle -- Function Handle

<classname> -- Any MATLAB or Java class

See also isnumeric, islogical, ischar, iscell, isstruct, isfloat,

isinteger, isobject, isjava, issparse, isreal, class.

Overloaded methods:

scribehandle/isa

serial/isa

instrument/isa

icinterface/isa

daqdevice/isa

fxptds.isa

icgroup/isa

icdevice/isa

rptcp/isa

rptsp/isa

Reference page in Help browser

doc isa

<isjava> - True for Java object arrays

ISJAVA True for Java object arrays

ISJAVA(J) returns 1 if J is a Java object array, and 0 otherwise.

See also isstruct, iscell, isnumeric, isobject, islogical.

Reference page in Help browser

doc isjava

<isobject> - True for MATLAB objects.

ISOBJECT True for MATLAB objects.

ISOBJECT(A) returns 1 if A is a MATLAB object and 0 otherwise.

See also iscell, isstruct, isnumeric, isjava.

Reference page in Help browser

doc isobject

<inferiorto> - Inferior class relationship.

INFERIORTO Specify inferior class relationship.

This function establishes a precedence that determines which object

method is called.

This function is used only from a constructor that uses the

CLASS function to create an object (the only way to create MATLAB

classes in versions prior to MATLAB Version 7.6).

INFERIORTO('CLASS1','CLASS2',...) invoked within a class

constructor method establishes that class as having lower precedence

than the classes in the function argument list for purposes of

function dispatching (i.e., which method or function is called in

any given situation).

For example, suppose that object A is of class 'CLASS_A', object B is

of class 'CLASS_B' and object C is of class 'CLASS_C', and all three

classes contain a method named FUN. Suppose also that constructor

method class_c.m contains the statement:

INFERIORTO('CLASS_A');

This establishes CLASS_A as taking precedence over CLASS_C for function

dispatching. Therefore, either of the following two statements:

E = FUN(A,C);

E = FUN(C,A);

will invoke CLASS_A/FUN.

If a function is called with two objects with an unspecified

relationship, then the two objects are considered to be of equal

precedence and the leftmost object's method is called. So

FUN(B,C) calls CLASS_B/FUN, while FUN(C,B) calls CLASS_C/FUN.

See also superiorto, class.

Reference page in Help browser

doc inferiorto

<superiorto> - Superior class relationship.

SUPERIORTO Superior class relationship.

This function establishes a precedence that determines which object

method is called.

This function is used only from a constructor that uses the

CLASS function to create an object (the only way to create MATLAB

classes in versions prior to MATLAB Version 7.6).

SUPERIORTO('CLASS1','CLASS2',...) invoked within a class

constructor method establishes that class as having precedence over

the classes in the function argument list for purposes of function

dispatching.

For example, suppose that object A is of class 'CLASS_A', object B is

of class 'CLASS_B' and object C is of class 'CLASS_C', and all three

classes contain a method named FUN. Suppose also that constructor

method class_c.m contains the statement:

SUPERIORTO('CLASS_A');

This establishes CLASS_C as taking precedence over CLASS_A for function

dispatching. Therefore, either of the following two statements:

E = FUN(A,C);

E = FUN(C,A);

will invoke CLASS_C/FUN.

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