Saturday, July 25, 2009

capture

capture is obsolete in Release 11 (5.3). getframe provides the same functionality and supports TrueColor displays by returning TrueColor images.

Syntax

  • capture
    capture(h)
    [X,cmap] = capture(h)

Description

capture creates a bitmap copy of the contents of the current figure, including any uicontrol graphics objects. It creates a new figure and displays the bitmap copy as an image graphics object in the new figure.

capture(h) creates a new figure that contains a copy of the figure identified by h.

[X,cmap] = capture(h) returns an image matrix X and a colormap. You display this information using the statements

  • colormap(cmap)
    image(X)
cart2pol

Transform Cartesian coordinates to polar or cylindrical

Syntax

  • [THETA,RHO,Z] = cart2pol(X,Y,Z)
    [THETA,RHO] = cart2pol(X,Y)

Description

[THETA,RHO,Z] = cart2pol(X,Y,Z) transforms three-dimensional Cartesian coordinates stored in corresponding elements of arrays X, Y, and Z, into cylindrical coordinates. THETA is a counterclockwise angular displacement in radians from the positive x-axis, RHO is the distance from the origin to a point in the x-y plane, and Z is the height above the x-y plane. Arrays X, Y, and Z must be the same size (or any can be scalar).

[THETA,RHO] = cart2pol(X,Y) transforms two-dimensional Cartesian coordinates stored in corresponding elements of arrays X and Y into polar coordinates.

Algorithm

The mapping from two-dimensional Cartesian coordinates to polar coordinates, and from three-dimensional Cartesian coordinates to cylindrical coordinates is


cart2sph

Transform Cartesian coordinates to spherical

Syntax

  • [THETA,PHI,R] = cart2sph(X,Y,Z)

Description

[THETA,PHI,R] = cart2sph(X,Y,Z) transforms Cartesian coordinates stored in corresponding elements of arrays X, Y, and Z into spherical coordinates. Azimuth THETA and elevation PHI are angular displacements in radians measured from the positive x-axis, and the x-y plane, respectively; and R is the distance from the origin to a point.

Arrays X, Y, and Z must be the same size.

Algorithm

The mapping from three-dimensional Cartesian coordinates to spherical coordinates is


case

Case switch

Description

case is part of the switch statement syntax, which allows for conditional execution.

A particular case consists of the case statement itself, followed by a case expression, and one or more statements.

A case is executed only if its associated case expression (case_expr) is the first to match the switch expression (switch_expr).

Examples

The general form of the switch statement is:

  • switch switch_expr
    case case_expr
    statement,...,statement
    case {case_expr1,case_expr2,case_expr3,...}
    statement,...,statement
    ...
    otherwise
    statement,...,statement
    end
cat

Concatenate arrays

Syntax

  • C = cat(dim,A,B)
    C = cat(dim,A1,A2,A3,A4...)

Description

C = cat(dim,A,B) concatenates the arrays A and B along dim.

C = cat(dim,A1,A2,A3,A4,...) concatenates all the input arrays (A1, A2, A3, A4, and so on) along dim.

cat(2,A,B) is the same as [A,B] and cat(1,A,B) is the same as [A;B].

Remarks

When used with comma separated list syntax, cat(dim,C{:}) or cat(dim,C.field) is a convenient way to concatenate a cell or structure array containing numeric matrices into a single matrix.

Examples

Given,

  • A =               B =
    1 2 5 6
    3 4 7 8

concatenating along different dimensions produces:

The commands

  • A = magic(3); B = pascal(3);
    C = cat(4,A,B);

produce a 3-by-3-by-1-by-2 array.



catch

Begin catch block

Description

The general form of a try statement is:

  • try,
    statement,
    ...,
    statement,
    catch,
    statement,
    ...,
    statement,
    end

Normally, only the statements between the try and catch are executed. However, if an error occurs while executing any of the statements, the error is captured into lasterr, and the statements between the catch and end are executed. If an error occurs within the catch statements, execution stops unless caught by another try...catch block. The error string produced by a failed try block can be obtained with lasterr.

No comments:

Post a Comment