1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Introduction to Function and Script Files (GNU Octave (version 10.3.0))</title>
<meta name="description" content="Introduction to Function and Script Files (GNU Octave (version 10.3.0))">
<meta name="keywords" content="Introduction to Function and Script Files (GNU Octave (version 10.3.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Functions-and-Scripts.html" rel="up" title="Functions and Scripts">
<link href="Defining-Functions.html" rel="next" title="Defining Functions">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
span:hover a.copiable-link {visibility: visible}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">
</head>
<body lang="en">
<div class="section-level-extent" id="Introduction-to-Function-and-Script-Files">
<div class="nav-panel">
<p>
Next: <a href="Defining-Functions.html" accesskey="n" rel="next">Defining Functions</a>, Up: <a href="Functions-and-Scripts.html" accesskey="u" rel="up">Functions and Scripts</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h3 class="section" id="Introduction-to-Function-and-Script-Files-1"><span>11.1 Introduction to Function and Script Files<a class="copiable-link" href="#Introduction-to-Function-and-Script-Files-1"> ¶</a></span></h3>
<p>There are seven different things covered in this section.
</p><ol class="enumerate">
<li> Typing in a function at the command prompt.
</li><li> Storing a group of commands in a file — called a script file.
</li><li> Storing a function in a file—called a function file.
</li><li> Subfunctions in function files.
</li><li> Multiple functions in one script file.
</li><li> Private functions.
</li><li> Nested functions.
</li></ol>
<p>Both function files and script files end with an extension of .m, for
<small class="sc">MATLAB</small> compatibility. If you want more than one independent
functions in a file, it must be a script file (see <a class="pxref" href="Script-Files.html">Script Files</a>),
and to use these functions you must execute the script file before you
can use the functions that are in the script file.
</p>
</div>
</body>
</html>
|