====== Differences ====== This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
gibson:teaching:fall-2014:math445:lecture7-diary [2014/10/07 11:43] gibson [A few more bells and whistles] |
gibson:teaching:fall-2014:math445:lecture7-diary [2014/10/07 11:44] (current) gibson [A function with an if statement and fprintf] |
||
---|---|---|---|
Line 60: | Line 60: | ||
- | The warning message is printed using the //formatted print function// ''fprintf''. ''fprintf'' takes a variable number of arguments. The first argument is always the ''format string''. The format string is simply a message to be printed with a number of slots into which values of variables will be substituted. The slots are marked with percent signs ''%'', and following the percents signs is a letter code that tells Matlab what type of variable to expect for the slot. Here ''%d'' tells Matlab to expect a decimal-valued variable (i.e. a floating-point number). | + | The warning message is printed using the //formatted print function// ''fprintf''. ''fprintf'' takes a variable number of arguments. The first argument is always the ''format string''. The format string is simply a message to be printed with a number of slots into which values of variables will be substituted. The slots are marked with percent signs ''%'', and following the percents signs is a letter code that tells Matlab what type of variable to expect for the slot. Here ''%d'' tells Matlab to expect a decimal-valued variable (i.e. a floating-point number). After the format string, the remaining arguments to ''fprintf'' are the variables whose values you want substituted into those slots. |