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

If you run out of memory often, here are some additional system

specific tips:

Windows: Increase virtual memory using the control panel.

Unix: Ask your system manager to increase your Swap Space.

You should cd to a directory where you have "write" permission to execute

this command successfully. The following lines of code will help you

accomplish the consolidation of workspace memory.

cwd = pwd;

cd(tempdir);

pack

cd(cwd)

See also memory, save, load, clear.

Overloaded methods:

mpc/pack

Reference page in Help browser

doc pack

<load> - Load workspace variables from disk.

LOAD Load data from MAT-file into workspace.

S = LOAD(FILENAME) loads the variables from a MAT-file into a structure

array, or data from an ASCII file into a double-precision array.

S = LOAD(FILENAME, VARIABLES) loads only the specified variables from a

MAT-file. VARIABLES use one of the following forms:

VAR1, VAR2, ... Load the listed variables. Use the '*'

wildcard to match patterns. For

example, load('A*') loads all variables

that start with A.

'-regexp', EXPRESSIONS Load only the variables that match the

specified regular expressions. For more

information on regular expressions, type

"doc regexp" at the command prompt.

S = LOAD(FILENAME, '-mat', VARIABLES) forces LOAD to treat the file as

a MAT-file, regardless of the extension. Specifying VARIABLES is

optional.

S = LOAD(FILENAME, '-ascii') forces LOAD to treat the file as an ASCII

file, regardless of the extension.

LOAD(...) loads without combining MAT-file variables into a structure

array.

LOAD ... is the command form of the syntax, for convenient loading from

the command line. With command syntax, you do not need to enclose input

strings in single quotation marks. Separate inputs with spaces instead

of commas. Do not use command syntax if FILENAME is a variable.

Notes:

If you do not specify filename, the load function searches for a file

named matlab.mat.

ASCII files must contain a rectangular table of numbers, with an equal

number of elements in each row. The file delimiter (character between

each element in a row) can be a blank, comma, semicolon, or tab. The

file can contain MATLAB comments.

Examples:

gongStruct = load('gong.mat') % All variables

load('handel.mat', 'y') % Only variable y

load('accidents.mat', 'hwy*') % Variables starting with "hwy"

load('topo.mat', '-regexp', '\d') % Variables containing digits

% Using command form

load gong.mat

load topo.mat -regexp \d

load 'hypothetical file.mat' % Filename with spaces

See also save, whos, clear, regexp, importdata, uiimport, fileformats.

Overloaded methods:

COM/load

vdspdebug/load

eclipseide/load

ghsmulti/load

mdevproject/load

cgproject/load

ccsdebug/load

Reference page in Help browser

doc load

<save> - Save workspace variables to disk.

SAVE Save workspace variables to file.

SAVE(FILENAME) stores all variables from the current workspace in a

MATLAB formatted binary file (MAT-file) called FILENAME.

SAVE(FILENAME,VARIABLES) stores only the specified variables.

SAVE(FILENAME,'-struct',STRUCTNAME,FIELDNAMES) stores the fields of the

specified scalar structure as individual variables in the file. If you

include the optional FIELDNAMES, the SAVE function stores only the

specified fields of the structure. You cannot specify VARIABLES and

the '-struct' keyword in the same call to SAVE.

SAVE(FILENAME, ..., '-append') adds new variables to an existing file.

You can specify '-append' with additional inputs such as VARIABLES,

'-struct', FORMAT, or VERSION.

SAVE(FILENAME, ..., FORMAT) saves in the specified format: '-mat' or

'-ascii'.

You can specify FORMAT with additional inputs such as VARIABLES,

'-struct', '-append', or VERSION.

SAVE(FILENAME, ..., VERSION) saves to MAT-files in the specified

version: '-v4', '-v6', '-v7', or '-v7.3'.

You can specify VERSION with additional inputs such as VARIABLES,

'-struct', '-append', or FORMAT.

SAVE FILENAME ... is the command form of the syntax, for convenient

saving from the command line. With command syntax, you do not need to

enclose strings in single quotation marks. Separate inputs with spaces

instead of commas. Do not use command syntax if inputs such as

FILENAME are variables.

Inputs:

FILENAME: If you do not specify FILENAME, the SAVE function saves to a

file named matlab.mat. If FILENAME does not include an extension and

the value of format is '-mat' (the default), MATLAB appends .mat. If

filename does not include a full path, MATLAB saves in the current

folder. You must have permission to write to the file.

VARIABLES: Save only selected variables from the workspace.

Use one of the following forms:

V1, V2, ... Save the listed variables. Use the '*'

wildcard to match patterns. For example,

save('A*') saves all variables that start

with A.

'-regexp', EXPRESSIONS Save only the variables that match the

specified regular expressions. SAVE treats

all inputs as regular expressions except

the optional FILENAME and STRUCTNAME. The

FILENAME input must appear first. For

more information on regular expressions,

type "doc regexp" at the command prompt.

'-struct', STRUCTNAME, FIELDNAMES: Save the fields of a scalar

structure as individual variables in the file. FIELDNAMES is optional;

specify to save only selected fields. FIELDNAMES use the same forms as

VARIABLES.

'-append': Add data to an existing file. For MAT-files, '-append' adds

new variables to the file or replaces the saved values of existing

variables with values in the workspace. For ASCII files, '-append'

adds data to the end of the file.

FORMAT: Specify the format of the file, regardless of any specified

extension. Use one of the following combinations:

'-mat' Binary MAT-file format (default).

'-ascii' 8-digit ASCII format.

'-ascii', '-tabs' Tab-delimited 8-digit ASCII format.

'-ascii', '-double' 16-digit ASCII format.

'-ascii', '-double', '-tabs' Tab-delimited 16-digit ASCII format.

For ASCII file formats, the SAVE function has the following

limitations:

* Each variable must be a two-dimensional double or char array.

* MATLAB translates characters to their corresponding internal

ASCII codes. For example, 'abc' appears in an ASCII file as:

9.7000000e+001 9.8000000e+001 9.9000000e+001

* The output includes only the real component of complex numbers.

* If you plan to use the LOAD function to read the file, all

variables must have the same number of columns.

VERSION: Create a MAT-file that you can load into an earlier version of

MATLAB or that supports specific features. The following table shows

the available MAT-file version options and the corresponding supported

features.

| Can Load in |

Option | Versions | Supported Features

---------+--------------+----------------------------------------------

'-v7.3' | 7.3 or later | Version 7.0 features plus support for

| | data items greater than or equal to 2GB on

| | 64-bit systems

---------+--------------+----------------------------------------------

'-v7.0' | 7.0 or later | Version 6 features plus data compression and

| | Unicode character encoding

---------+--------------+----------------------------------------------

'-v6' | 5 or later | Version 4 features plus N-dimensional arrays,

| | cell and structure arrays, and variable names

| | greater than 19 characters

---------+--------------+----------------------------------------------

'v4' | all | Two-dimensional double, character, and

| | sparse arrays

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