- •Xregpointer/logical
- •Value arrays are placed into corresponding structure array elements.
- •Isfield, rmfield, deal, substruct, struct2cell, cell2struct.
- •Is the Java class specified by the character string classname.
- •Cell array functions
- •Vector of row sizes (must sum to row) and n is the vector of column
- •Array functions
- •If an error handler is not specified, the error from the call to
- •Value arrays are placed into corresponding structure array elements.
- •Isfield, rmfield, deal, substruct, struct2cell, cell2struct.
- •Identical way.
- •Idivide - Integer division with rounding option.
- •Vertcat - Vertical concatenation [;]
- •Byte manipulation functions.
- •Object oriented programming functions
- •Value arrays are placed into corresponding structure array elements.
- •In a cell array of strings.
- •If a function is called with two objects with an unspecified
- •If the input object does not match the current definition (as defined
- •Information outside the object array into saveable form (so that a
Byte manipulation functions.
<swapbytes> - Swap byte ordering, changing endianness.
SWAPBYTES Swap byte ordering, changing endianness.
Y = SWAPBYTES(X) reverses the byte ordering of the matrix X,
converting little-endian values to big-endian (and vice versa).
Example:
X = uint16([0 1 128 65535]);
Y = swapbytes(X);
Y will have the following uint16 values:
[0 256 32768 65535]
Examining the output in hex notation shows the byte swapping:
format hex
X, Y
format
See also typecast.
Overloaded methods:
codistributed/swapbytes
Reference page in Help browser
doc swapbytes
<typecast> - Convert datatypes without changing underlying data.
TYPECAST Convert datatypes without changing underlying data.
Y = TYPECAST(X, DATATYPE) convert X to DATATYPE. If DATATYPE has fewer bits than the class of X, Y will have more elements than X. If
DATATYPE has more bits than the class of X, Y will have fewer
elements than X. X must be a scalar or vector. DATATYPE must be one
of 'UINT8', 'INT8', 'UINT16', 'INT16', 'UINT32', 'INT32', 'UINT64',
'INT64', 'SINGLE', or 'DOUBLE'.
Note: An error is issued if X contains fewer values than are needed
to make an output value.
Example:
X = uint32([1 255 256]);
Y = typecast(X, 'uint8');
On little-endian architectures Y will be
[1 0 0 0 255 0 0 0 0 1 0 0]
See also class, cast, swapbytes.
Overloaded methods:
codistributed/typecast
Reference page in Help browser
doc typecast
Object oriented programming functions
<class> - Create object or return object class.
CLASS Return class name of object.
S = CLASS(OBJ) returns the name of the class of object OBJ.
Possibilities are:
double -- Double precision floating point number array
(this is the traditional MATLAB matrix or array)
single -- Single precision floating point number array
logical -- Logical array
char -- Character array
cell -- Cell array
struct -- Structure array
function_handle -- Function Handle
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
<class_name> -- MATLAB class name for MATLAB objects
<java_class> -- Java class name for java objects
%Example 1: Obtain the name of the class of value PI
name = class(PI);
%Example 2: Obtain the full name of a package-based java class
import java.lang.*;
obj = String('mystring');
class(obj)
For classes created without a CLASSDEF statement (pre-MATLAB version
7.6 syntax), CLASS invoked within a constructor method creates an
object of type 'class_name'. Constructor methods are functions saved
in a file named <class_name>.m and placed in a directory named
@<class_name>. Note that 'class_name' must be the second argument to
CLASS. Uses of CLASS for this purpose are shown below.
O = CLASS(S,'class_name') creates an object of class 'class_name'
from the structure S.
O = CLASS(S,'class_name',PARENT1,PARENT2,...) also inherits the
methods and fields of the parent objects PARENT1, PARENT2, ...
O = CLASS(struct([]),'class_name',PARENT1,PARENT2,...), specifying
an empty structure S, creates an object that inherits the methods and
fields from one or more parent classes, but does not have any
additional fields beyond those inherited from the parents.
See also isa, superiorto, inferiorto, classdef, struct.
Overloaded methods:
scribehandle/class
serial/class
digitalio/class
analogoutput/class
analoginput/class
visa/class
udp/class
tcpip/class
icgroup/class
icdevice/class
gpib/class
Reference page in Help browser
doc class
<classdef> - Define a new MATLAB class.
CLASSDEF Define new class or sub-class.
The keyword CLASSDEF denotes the start of a MATLAB class
definition. The MATLAB language defines classes including
double, logical, struct, and cell. These classes control
how values stored in variables behave, including how they
are displayed and allowed forms of indexing.
You can use class definitions to add new classes or add
specialized sub-classes based on existing classes.
CLASSDEF begins a block terminated by END. Only white
space and comments can precede the class definition.
You must place a class definition in a file with the same
name as the class, with a filename extension of '.m'.
Example:
%Create a class named payment, placed in file 'payment.m'
classdef payment
properties
rate;
term;
principle;
end
methods
function obj = payment(r,t,p)
obj.rate = r;
obj.term = t;
obj.principle = p;
end
function disp(obj)
i = obj.rate/(12*100);
payAmt = (obj.principle * i)/(1 - (1+i)^(-obj.term));
s = sprintf('%s%.2f%s%4.2f%s%.2f%s%d%s',...
'Payment per month on a loan of $', obj.principle,...
' at an annual interest rate of ', obj.rate,...
'% is $', payAmt, ' for ', obj.term, ' months.');
disp(s);
end
end
end
See also properties, methods, events.
Reference page in Help browser
doc classdef
<struct> - Convert object to structure array.
STRUCT Create or convert to structure array.
S = STRUCT('field1',VALUES1,'field2',VALUES2,...) creates a
structure array with the specified fields and values. The value
arrays VALUES1, VALUES2, etc. must be cell arrays of the same
size, scalar cells or single values. Corresponding elements of the