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

If the most recent I/o operation was successful, message is empty

and ERRNUM is 0. A nonzero ERRNUM indicates that an error

occurred. Positive values of ERRNUM match those returned by the C

library on your platform. Negative values are MATLAB-specific.

[...] = FERROR(FID,'clear') also clears the error indicator for

the specified file. Succeeding calls to FERROR with the same FID, and

no intervening calls to other file I/O functions using the same FID,

will behave as if the most recent I/O operation was successful.

See also fclose, feof, fopen, fprintf, fread, fscanf, fseek, ftell,

fwrite.

Reference page in Help browser

doc ferror

<frewind> - Rewind file.

FREWIND Rewind file.

FREWIND(FID) sets the file position indicator to the beginning of

the file associated with file identifier FID.

WARNING: Rewinding an FID associated with a tape device may not work.

In such cases, no error message is generated.

See also fopen, fprintf, fread, fscanf, fseek, ftell, fwrite.

Reference page in Help browser

doc frewind

<fseek> - Set file position indicator.

FSEEK Set file position indicator.

STATUS = FSEEK(FID, OFFSET, ORIGIN) repositions the file position

indicator in the file associated with the given FID. FSEEK sets the

position indicator to the byte with the specified OFFSET relative to

ORIGIN.

FID is an integer file identifier obtained from FOPEN.

OFFSET values are interpreted as follows:

>= 0 Move position indicator OFFSET bytes after ORIGIN.

< 0 Move position indicator OFFSET bytes before ORIGIN.

ORIGIN values are interpreted as follows:

'bof' or -1 Beginning of file

'cof' or 0 Current position in file

'eof' or 1 End of file

STATUS is 0 on success and -1 on failure. If an error occurs, use

FERROR to get more information.

Example:

fseek(fid,0,-1)

"rewinds" the file.

See also ferror, fopen, fprintf, fread, frewind, fscanf, fseek, ftell,

fwrite.

Reference page in Help browser

doc fseek

<ftell> - Get file position indicator.

FTELL Get file position indicator.

POSITION = FTELL(FID) returns the location of the file position

Indicator in the specified file. Position is indicated in bytes

from the beginning of the file. If -1 is returned, it indicates

that the query was unsuccessful. Use FERROR to determine the nature

of the error.

FID is an integer file identifier obtained from FOPEN.

See also ferror, fopen, fprintf, fread, frewind, fscanf, fseek, fwrite.

Reference page in Help browser

doc ftell

Memory-mapped file support

<memmapfile> - Construct memory-mapped file object.

MEMMAPFILE Construct memory-mapped file object.

M = MEMMAPFILE(FILENAME) constructs a memmapfile object that maps file FILENAME to memory, using default property values. FILENAME can be a partial pathname relative to the MATLAB path. If the file is not found in or relative to the current working directory, MEMMAPFILE searches down the

MATLAB search path.

M = MEMMAPFILE(FILENAME, PROP1, VALUE1, PROP2, VALUE2, ...) constructs a memmapfile object, and sets the properties of that object that are named in the argument list (PROP1, PROP2, etc.) to the given values (VALUE1, VALUE2,etc.). All property name arguments must be quoted strings (e.g.,

'Writable'). Any properties that are not specified are given their default

values.

Property/Value pairs and descriptions:

Format: Char array or Nx3 cell array (defaults to 'uint8').

Format of the contents of the mapped region.

If a char array, Format specifies that the mapped data is to be

accessed as a single vector of type specified by Format's

value. Supported char arrays are 'int8', 'int16', 'int32', 'int64',

'uint8', 'uint16', 'uint32', 'uint64', 'single', and 'double'.

If an Nx3 cell array, Format specifies that the mapped data is to be

accessed as a repeating series of segments of basic types, each with

specific dimensions and name. The cell array must be of the form

{TYPE1, DIMS1, NAME1; ...; TYPEn, DIMSn, NAMEn}, where TYPE is one of the data type strings listed above, DIMS is a numeric row vector

specifying the dimensions of the segment of data to use, and NAME is

a char string specifying the field name to use to access the data

(as a subfield of the Data property). See Data property and examples

below.

Repeat: Positive integer or Inf (defaults to Inf).

Number of times to apply the specified format to the mapped

region of the file. If Inf, repeat until end of file.

Offset: Nonnegative integer (defaults to 0).

Number of bytes from the start of the file to the start of the

mapped region. Offset 0 represents the start of the file.

Writable: True or false (defaults to false).

Access level which determines whether or not Data property (see

below) may be assigned to.

All the properties above may also be accessed after the memmapfile object

has been created by dot-subscripting the memmapfile object. For example,

M.Writable = true;

changes the Writable property of M to true.

Two properties which may not be specified to the MEMMAPFILE constructor as Property/Value pairs are listed below. These may be accessed (with

dot-subscripting) after the memmapfile object has been created.

Data: Numeric array or structure array.

Contains the actual memory-mapped data from FILENAME. If Format is a

char array, then Data is a simple numeric array of the type

specified by Format. If Format is a cell array, then Data is a

structure array, the field names of which are specified by the third

column of the cell array. The type and shape of each field of Data

are determined by the first and second columns of the cell array,

respectively. Changes to the Data field or subfields also change the

corresponding values in the memory-mapped file.

Filename: Char array.

Contains the name of the file being mapped.

Note that when a variable containing a memmapfile object goes out of scope

or is otherwise cleared, the memory map is automatically unmapped.

Examples:

% To map the file 'records.dat' to a series of unsigned 32-bit

% integers and set every other value to zero (in Data and

% records.dat):

m = memmapfile('records.dat', 'Format', 'uint32', 'Writable', true);

m.data(1:2:end) = 0;

% To map the file 'records.dat' to a repeating series of 20 singles

% (as a 5-by-4 matrix) called 'sdata', followed by 10 doubles (as a

1-by-10 vector) called 'ddata':

m = memmapfile('records.dat', 'Format', {'single' [5 4] 'sdata'; ...

'double', [1 10] 'ddata'});

firstSdata = m.Data(1).sdata;

firstDdata = m.Data(1).ddata;

See also memmapfile/disp, memmapfile/get, memmapfile/subsasgn,

memmapfile/subsref.

Reference page in Help browser

doc memmapfile

File name handling

<fileparts> - Filename parts.

FILEPARTS Filename parts.

[PATHSTR,NAME,EXT] = FILEPARTS(FILE) returns the path, file name, and

file name extension for the specified FILE. The FILE input is a string

containing the name of a file or folder, and can include a path and

file name extension. The function interprets all characters following

the right-most path delimiter as a file name plus extension.

If the FILE input consists of a folder name only, be sure that the

right-most character is a path delimiter (/ or \). Othewise, FILEPARTS

parses the trailing portion of FILE as the name of a file and returns

it in NAME instead of in PATHSTR.

FILEPARTS only parses file names. It does not verify that the file or

folder exists. You can reconstruct the file from the parts using

fullfile(pathstr,[name ext versn])

FILEPARTS is platform dependent.

On Microsoft Windows systems, you can use either forward (/) or back

(\) slashes as path delimiters, even within the same string. On Unix

and Macintosh systems, use only / as a delimiter.

See also fullfile, pathsep, filesep.

Reference page in Help browser

doc fileparts

<filesep> - Directory separator for this platform.

FILESEP Directory separator for this platform.

F = FILESEP returns the file separator character for this platform.

The file separator is the character that separates

directory names in filenames.

See also pathsep, fullfile.

Reference page in Help browser

doc filesep

<filemarker> - Character that separates a file and a within-file function name.

FILEMARKER Character that separates a file and a within-file function name.

M = FILEMARKER returns the character that separates a file and

a within-file function name.

See also filesep.

Reference page in Help browser

doc filemarker

<fullfile> - Build full filename from parts.

FULLFILE Build full filename from parts.

FULLFILE(D1,D2, ... ,FILE) builds a full file name from the

directories D1,D2, etc and filename FILE specified. This is

conceptually equivalent to

F = [D1 filesep D2 filesep ... filesep FILE]

except that care is taken to handle the cases where the directory

parts D1, D2, etc. may begin or end in a filesep. Specify FILE = ''

to build a pathname from parts.

Examples

To build platform dependent paths to files:

fullfile(matlabroot,'toolbox','matlab','general','Contents.m')

To build platform dependent paths to a directory:

addpath(fullfile(matlabroot,'toolbox','matlab',''))

See also filesep, pathsep, fileparts.

Reference page in Help browser

doc fullfile

<matlabroot> - Root directory of MATLAB installation.

MATLABROOT Root directory of MATLAB installation.

S = MATLABROOT returns a string that is the name of the directory

where the MATLAB software is installed.

MATLABROOT is used to produce platform dependent paths

to the various MATLAB and toolbox directories.

Example

fullfile(matlabroot,'toolbox','matlab','general','')

produces a full path to the toolbox/matlab/general directory that

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