The main contents of the chapter consist of the following: Function M-files, syntax of function M-Files, comments, multiple input and output functions, relational model concepts, relational model constraints and relational database schemas, update operations and dealing with constraint violations. | Lecture note Data visualization - Chapter 27 Lecture 27 Recap Function M files Syntax of Function M Files Comments Multiple Input and Output Functions Functions with No Input or No Output Although most functions need at least one input and return at least one output value in some situations no inputs or outputs are required For example consider this function which draws a star in polar coordinates function star theta pi 2 pi pi r ones 1 6 polar theta r The square brackets on the first line indicate that the Continued . There are numerous built in MATLAB functions that do not require any input. For example A clock returns the current time A 003 Columns 1 through 4 Columns 5 through 6 Determining the Number of Input and Output Arguments There may be times when you want to know the number of input arguments or output values associated with a function MATLAB provides two built in functions for this purpose The nargin function determines the number of input arguments in either a user defined function or a built in function The name of the function must be specified as a string as for example in nargin sin Continued . When nargin is used inside a user defined function it determines how many input arguments were actually entered This allows a function to have a variable number of inputs Recall graphing functions such as surf When surf has a single matrix input a graph is created using the matrix index numbers as the x and y coordinates. When there are three inputs x y and z the graph is based on the specified x and y values The nargin function allows the programmer to determine Continued . The surf function is an example of a function with a variable number of inputs If we use nargin from the command window to determine the number of declared inputs there isn t one correct answer The nargin function returns a negative number to let us know that a variable number of inputs are possible nargin surf ans 1 The nargout function is .