Saturday, July 25, 2009

cd

Change working directory

Graphical Interface

As an alternative to the cd function, use the Current Directory field in the MATLAB desktop toolbar.

Syntax

  • cd
    w = cd
    cd('directory')
    cd('..')
    cd directory or cd ..

Description

cd displays the current working directory.

w = cd assigns the current working directory to w.

cd('directory') sets the current working directory to directory. Use the full pathname for directory. On UNIX platforms, the character ~ is interpreted as the user's root directory.

cd('..') changes the current working directory to the directory above it.

cd directory or cd .. is the unquoted form of the syntax.

Examples

On UNIX

  • cd('/usr/local/matlab/toolbox/demos')

changes the current working directory to demos.

On Windows

  • cd('c:/toolbox/matlab/demos')

changes the current working directory to demos. Then typing

  • cd ..

changes the current working directory to matlab.



cdf2rdf

Convert complex diagonal form to real block diagonal form

Syntax

  • [V,D] = cdf2rdf(V,D)

Description

If the eigensystem [V,D] = eig(X) has complex eigenvalues appearing in complex-conjugate pairs, cdf2rdf transforms the system so D is in real diagonal form, with 2-by-2 real blocks along the diagonal replacing the complex pairs originally there. The eigenvectors are transformed so that

  • X = V*D/V

continues to hold. The individual columns of V are no longer eigenvectors, but each pair of vectors associated with a 2-by-2 block in D spans the corresponding invariant vectors.

Examples

The matrix

  • X =
    1 2 3
    0 4 5
    0 -5 4

has a pair of complex eigenvalues.

  • [V,D] = eig(X)

    V =

    1.0000 -0.0191 - 0.4002i -0.0191 + 0.4002i
    0 0 - 0.6479i 0 + 0.6479i
    0 0.6479 0.6479

    D =

    1.0000 0 0
    0 4.0000 + 5.0000i 0
    0 0 4.0000 - 5.0000i

Converting this to real block diagonal form produces

  • [V,D] = cdf2rdf(V,D)

    V =

    1.0000 -0.0191 -0.4002
    0 0 -0.6479
    0 0.6479 0

    D =

    1.0000 0 0
    0 4.0000 5.0000
    0 -5.0000 4.0000

Algorithm

The real diagonal form for the eigenvalues is obtained from the complex form using a specially constructed similarity transformation.



cdfepoch

Construct a cdfepoch object for Common Data Format (CDF) export

Syntax

  • E = cdfepoch(date)

Description

E = cdfepoch(date) constructs a cdfepoch object, where date is a valid string (datestr), a number (datenum) representing a date, or a cdfepoch object.

When writing data to a CDF using cdfwrite, use cdfepoch to convert MATLAB formatted dates to CDF formatted dates. The MATLAB cdfepoch object simulates the CDFEPOCH datatype in CDF files

Note A CDF epoch is the number of milliseconds since 1-Jan-0000. MATLAB datenums are the number of days since 0-Jan-0000.

cdfinfo

Return information about a CDF file

Syntax

  • info = cdfinfo(file)

Description

info = cdfinfo(file) returns information about the Common Data Format (CDF) file specified in the string, file. The function returns a structure, info, that contains the fields shown in the following table.


Field
Description
Return Type
FileModDate
Date the file was last modified
String
Filename
Name of the file
String
FileSettings
Library settings used to create the file
Structure array
FileSize
Size of the file, in bytes
Double
Format
File format (CDF)
String
FormatVersion
Version of the CDF library used to create the file
String
GlobalAttributes
Global metadata
Structure array
Subfiles
Filenames containing the CDF file's data, if it is a multifile CDF
Cell array
VariableAttributes
Metadata for the variables
Structure array
Variables
Details about the variables in the file
Cell array

The GlobalAttributes and VariableAttributes Fields

GlobalAttributes and VariableAttributes are structure arrays that each contain one field for each global or variable attribute respectively. The name of the field corresponds to the name of an attribute. The data in that field, contained in a cell array, represents the entry values for that attribute.

For VariableAttributes, the attribute data resides in an N-by-2 cell array, where N is the number of variables. The first column of this cell array contains the variable names associated with the entries. The second column contains the entry values.

    Note Attribute names may not match the names of the attributes in the CDF file exactly. Because attribute names can contain characters that are illegal in MATLAB field names, they may be translated into legal field names. Illegal characters that appear at the beginning of attributes are removed; other illegal characters are replaced with underscores ('_'). If an attribute's name is modified, the attribute's internal number is appended to the end of the field name. For example, Variable%Attribute might become Variable_Attribute_013.

The Variables Field

The Variables field of the returned info structure is an N-by-6 cell array, where N is the number of variables. The six columns of the cell array contain the following information.


Column No.
Description
Return Type
1
Name of the variable
String
2
Dimensions of the variable, as returned by the size function
Double array
3
Number of records assigned for the variable
Double
4
Data type of the variable, as stored in the CDF file
String
5

Record and dimension variance settings for the variable. The single T or F to the left of the slash designates whether values vary by record. The zero or more T or F letters to the right of the slash designate whether values vary at each dimension. Here are some examples.

  • T/      (scalar variable)
    F/T (one-dimensional variable)
    T/TFF (three-dimensional variable)
String
6

Sparsity of the variable's records. This is a string holding one of three possible values:

  • 'Full'
  • 'Sparse (padded)'
  • 'Sparse (nearest)'
String

Examples

  • info = cdfinfo('example.cdf')
    info =
    Filename: 'example.cdf'
    FileModDate: '29-Jun-1995 05:51:58'
    FileSize: 230513
    Format: 'CDF'
    FormatVersion: '2.4.8'
    FileSettings: [1x1 struct]
    Subfiles: {}
    Variables: {7x6 cell}
    GlobalAttributes: [1x1 struct]
    VariableAttributes: [1x1 struct]

    info.Variables
    ans =
    'L_gse' [1x2 double] [ 1] 'char' 'F/T' 'Full'
    'Status%C1' [1x2 double] [7493] 'uint8' 'T/T' 'Full'
    'B_gse%C1' [1x2 double] [7493] 'single' 'T/T' 'Full'
    'B_nsigma%C1' [1x2 double] [7493] 'single' 'T/' 'Full'

No comments:

Post a Comment