Skip to main content
Library homepage
 
Engineering LibreTexts

5.9: Matlab Functions with No Inputs and No Outputs

  • Page ID
    84408
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Tags recommended by the template: article:topic

    By Carey A. Smith

    These built-in Matlab functions have no inputs and no returned variables, although they may display values, change the screen, or change a plot.

    colorbar % For 3D plots

    lc % Clears the console

    The function definition of such a file would be like this:

    function [] = clc()

    A user could create a function with no inputs and no output variables, but it displays a figure or information. For example, a function called my_contact.m could display a user’s name and contact information:

    function [] = my_contact()

    Name = 'Harper Lee'

    Email = ToKillAMockingbird@google.com

    end


    This page titled 5.9: Matlab Functions with No Inputs and No Outputs is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Carey Smith.