type
Display contents of file
Syntax
Description
Examples
Display the contents of the file diceRoll. Since diceRoll does not exist, but diceRoll.m does exist, MATLAB displays the contents of diceRoll.m.
type diceRollfunction [d1,d2] = diceRoll str = '@()randi([1 6],1)'; d1 = str2func(str); d2 = eval(str); end function r = randi(~,~) r = 1; end
Input Arguments
File name to display, specified as a character vector or a string.
filename can be an absolute or relative path and can
include a path and a file extension. type supports file
names with these extensions, files with any other extension are treated as
plain text.
| File Extension | Description |
|---|---|
.mlx | MATLAB Live Script — An interactive document created using MATLAB Live Editor |
.mlapp | MATLAB App File — An app created using MATLAB App Designer |
.m | MATLAB Code — A MATLAB script, function, or class |
If you do not specify a file extension and a file without
an extension does not exist, then type assumes that the
extension is .mlx, .mlapp, or
.m. For example, if a file
myscript.m exists, then the command type
myscript displays the contents of that file.
type leverages automatic character set detection to
determine the file encoding for MATLAB code (.m) and other text files.
Extended Capabilities
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Version History
Introduced in R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)