MATLAB POLYSPACE 7 Guia de Instalação Página 276

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
Vista de página 275
5 Workspace, Search Path, and File Operations
action so that MATLAB runs the file you want—for more information, see
“How the Search Path Determines Which Function to Use” on page 5-24.
ThesearchpathisalsoreferredtoastheMATLAB path. Directories included
areconsideredtobeon the path. When you include a directory in the search
path, you add it to the path. Subdirectories must be explicitly added to the
path; they are not on the path just beca use their parent directories are.
Adding directories to the path is similar to performing an include or import
in some other applications.
For instructions to view the search path and add directories to it, see “Viewing
and Setting the Search Path” on page 5-26, including “Caution Against Saving
Files in matlabroot/toolbox” on page 5-31.
How the Search Path Determines Which Function to
Use
The order of directories on the path is relevant. M ATLAB looks for a named
element, for example,
foo, as described here. If you enter foo at the M ATLAB
prompt, MATLAB p erforms the following actio ns :
1 Looks f or foo as a variable.
2 Looks in the current directory for a file named foo.m.
3 Searches the directories on the MATLAB search path, in order, for foo as a
built-in function, followed by
foo.m which is not built-in.
If there is more than one function with the same name, the order of directories
on the p ath determines which of those functions MATLAB uses. When
MATLAB looks for that function, it uses the first one found in the search path:
To use a function with the same name that is located in a directory further
down on the search path, called a shadowed function, make its location
the current directory. For M -file scripts, you can use
run with the full
pathname for the M-file. For example, use
run d:/mymfiles/foo.m to
ensure that version of
foo runs. Another option is to move the d irectory
containing the shadowed function to a position in the search path ahead of
the directory containing the file of the same name. For example, add it to
the top of the search path.
5-24
Vista de página 275
1 2 ... 271 272 273 274 275 276 277 278 279 280 281 ... 617 618

Comentários a estes Manuais

Sem comentários