fname

Get a file's name

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

fname(n)

Description

fname(n) returns the name of the file specified by the file descriptor n.

The file must have been opened with fopen. The call to fopen yields the file descriptor n representing the file.

The special file descriptor 0 represents no file but output to the user interface instead; fname(0) returns NIL.

Examples

Example 1

We open a temporary file for writing. This yields the file descriptor n:

n := fopen(TempFile);

We get the file's name. Note that the name depends on the operating system:

fname(n);

Parameters

n

A file descriptor returned by fopen: a positive integer

Return Values

the name of the file: a character string of type DOM_STRING, or NIL.

See Also

MuPAD Functions