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 diceRoll
function [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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)