
\begin{DoxyItemize}
\item \hyperlink{freemat_addpath}{A\-D\-D\-P\-A\-T\-H Add }  
\item \hyperlink{freemat_assignin}{A\-S\-S\-I\-G\-N\-I\-N Assign Variable in Workspace}  
\item \hyperlink{freemat_blaslib}{B\-L\-A\-S\-L\-I\-B Select B\-L\-A\-S library}  
\item \hyperlink{freemat_builtin}{B\-U\-I\-L\-T\-I\-N Evaulate Builtin Function}  
\item \hyperlink{freemat_clc}{C\-L\-C Clear Dislplay}  
\item \hyperlink{freemat_clock}{C\-L\-O\-C\-K Get Current Time}  
\item \hyperlink{freemat_clocktotime}{C\-L\-O\-C\-K\-T\-O\-T\-I\-M\-E Convert Clock Vector to Epoch Time}  
\item \hyperlink{freemat_computer}{C\-O\-M\-P\-U\-T\-E\-R Computer System Free\-Mat is Running On}  
\item \hyperlink{freemat_diary}{D\-I\-A\-R\-Y Create a Log File of Console}  
\item \hyperlink{freemat_docli}{D\-O\-C\-L\-I Start a Command Line Interface}  
\item \hyperlink{freemat_edit}{E\-D\-I\-T Open Editor Window}  
\item \hyperlink{freemat_editor}{E\-D\-I\-T\-O\-R Open Editor Window}  
\item \hyperlink{freemat_errorcount}{E\-R\-R\-O\-R\-C\-O\-U\-N\-T Retrieve the Error Counter for the Interpreter}  
\item \hyperlink{freemat_etime}{E\-T\-I\-M\-E Elapsed Time Function}  
\item \hyperlink{freemat_eval}{E\-V\-A\-L Evaluate a String}  
\item \hyperlink{freemat_evalin}{E\-V\-A\-L\-I\-N Evaluate a String in Workspace}  
\item \hyperlink{freemat_exit}{E\-X\-I\-T Exit Program}  
\item \hyperlink{freemat_feval}{F\-E\-V\-A\-L Evaluate a Function}  
\item \hyperlink{freemat_filesep}{F\-I\-L\-E\-S\-E\-P Directory Separation Character}  
\item \hyperlink{freemat_help}{H\-E\-L\-P Help}  
\item \hyperlink{freemat_helpwin}{H\-E\-L\-P\-W\-I\-N Online Help Window}  
\item \hyperlink{freemat_jitcontrol}{J\-I\-T\-C\-O\-N\-T\-R\-O\-L Control the Just In Time Compiler}  
\item \hyperlink{freemat_mfilename}{M\-F\-I\-L\-E\-N\-A\-M\-E Name of Current Function}  
\item \hyperlink{freemat_path}{P\-A\-T\-H Get or Set Free\-Mat Path}  
\item \hyperlink{freemat_pathsep}{P\-A\-T\-H\-S\-E\-P Path Directories Separation Character}  
\item \hyperlink{freemat_pathtool}{P\-A\-T\-H\-T\-O\-O\-L Open Path Setting Tool}  
\item \hyperlink{freemat_pcode}{P\-C\-O\-D\-E Convert a Script or Function to P-\/\-Code}  
\item \hyperlink{freemat_profiler}{P\-R\-O\-F\-I\-L\-E\-R Control Profiling}  
\item \hyperlink{freemat_quiet}{Q\-U\-I\-E\-T Control the Verbosity of the Interpreter}  
\item \hyperlink{freemat_quit}{Q\-U\-I\-T Quit Program}  
\item \hyperlink{freemat_rehash}{R\-E\-H\-A\-S\-H Rehash Directory Caches}  
\item \hyperlink{freemat_rescan}{R\-E\-S\-C\-A\-N Rescan M Files for Changes}  
\item \hyperlink{freemat_rootpath}{R\-O\-O\-T\-P\-A\-T\-H Set Free\-Mat Root Path}  
\item \hyperlink{freemat_saveretvalue}{S\-A\-V\-E\-R\-E\-T\-V\-A\-L\-U\-E Save Return Value Of Function}  
\item \hyperlink{freemat_simkeys}{S\-I\-M\-K\-E\-Y\-S Simulate Keypresses from the User}  
\item \hyperlink{freemat_sleep}{S\-L\-E\-E\-P Sleep For Specified Number of Seconds}  
\item \hyperlink{freemat_source}{S\-O\-U\-R\-C\-E Execute an Arbitrary File}  
\item \hyperlink{freemat_startup}{S\-T\-A\-R\-T\-U\-P Startup Script}  
\item \hyperlink{freemat_tic}{T\-I\-C Start Stopwatch Timer}  
\item \hyperlink{freemat_toc}{T\-O\-C Stop Stopwatch Timer}  
\item \hyperlink{freemat_version}{V\-E\-R\-S\-I\-O\-N The Current Version Number}  
\item \hyperlink{freemat_verstring}{V\-E\-R\-S\-T\-R\-I\-N\-G The Current Version String}  
\end{DoxyItemize}\hypertarget{freemat_addpath}{}\section{A\-D\-D\-P\-A\-T\-H Add}\label{freemat_addpath}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily addpath} routine adds a set of directories to the current path. The first form takes a single directory and adds it to the beginning or top of the path\-: \begin{DoxyVerb}  addpath('directory')
\end{DoxyVerb}
 The second form add several directories to the top of the path\-: \begin{DoxyVerb}  addpath('dir1','dir2',...,'dirn')
\end{DoxyVerb}
 Finally, you can provide a flag to control where the directories get added to the path \begin{DoxyVerb}  addpath('dir1','dir2',...,'dirn','-flag')
\end{DoxyVerb}
 where if {\ttfamily flag} is either {\ttfamily '-\/0'} or {\ttfamily '-\/begin'}, the directories are added to the top of the path, and if the {\ttfamily flag} is either {\ttfamily '-\/1'} or {\ttfamily '-\/end'} the directories are added to the bottom (or end) of the path. \hypertarget{freemat_assignin}{}\section{A\-S\-S\-I\-G\-N\-I\-N Assign Variable in Workspace}\label{freemat_assignin}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily assignin} function allows you to assign a value to a variable in either the callers work space or the base work space. The syntax for {\ttfamily assignin} is \begin{DoxyVerb}   assignin(workspace,variablename,value)
\end{DoxyVerb}
 The argument {\ttfamily workspace} must be either 'caller' or 'base'. If it is 'caller' then the variable is assigned in the caller's work space. That does not mean the caller of {\ttfamily assignin}, but the caller of the current function or script. On the other hand if the argument is 'base', then the assignment is done in the base work space. Note that the variable is created if it does not already exist. \hypertarget{freemat_blaslib}{}\section{B\-L\-A\-S\-L\-I\-B Select B\-L\-A\-S library}\label{freemat_blaslib}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily blaslib} function allows you to select the Free\-Mat blas library. It has two modes of operation. The first is to select blas library\-: \begin{DoxyVerb}  blaslib LIB_NAME
\end{DoxyVerb}
 If you want to see current blas library selected issue a {\ttfamily blaslib} command with no arguments. \begin{DoxyVerb}   blaslib
\end{DoxyVerb}
 the returned list of libraries will include an asterix next to the library currently selected. If no library is selected, Free\-Mat will use its internal (reference) B\-L\-A\-S implementation, which is slow, but portable.

Location of the optimized library is specified in blas.\-ini file which is installed in the binary directory (i.\-e. directory where Free\-Mat executable is located).

The format of blas.\-ini file is following\-: \begin{DoxyVerb} [Linux64]
ATLAS64\libname=/usr/lib64/atlas/libblas.so
ATLAS64\capfnames=false
ATLAS64\prefix=
ATLAS64\suffix=_
ATLAS64\desc="ATLAS BLAS. Optimized."
\end{DoxyVerb}
 Where Linux64 is the O\-S flavor for the blas library described below it. Other options are \mbox{[}Win32\mbox{]}, \mbox{[}Linux32\mbox{]}, \mbox{[}O\-S\-X\mbox{]}. Note that Linux is our name for all unix platforms. 
\begin{DoxyItemize}
\item {\ttfamily A\-T\-L\-A\-S64} -\/ name of the library as it will appear in the list when you type blaslib command in Free\-Mat.  
\item {\ttfamily A\-T\-L\-A\-S64\textbackslash{}libname} -\/ path to the library. It has to be a shared library (Linux), D\-L\-L (Windows), Bundle (? O\-S\-X). This library has to be a Fortran B\-L\-A\-S library, not cblas!  
\item {\ttfamily A\-T\-L\-A\-S64\textbackslash{}capfnames} -\/ does the library use capital letters for function names (usually false).  
\item {\ttfamily A\-T\-L\-A\-S64\textbackslash{}prefix} -\/ prefix (characters that are put in front of) for all blas functions in the library (e.\-g. {\ttfamily A\-T\-L\-\_\-} or {\ttfamily A\-M\-D\-\_\-}).  
\item {\ttfamily A\-T\-L\-A\-S64\textbackslash{}suffix} -\/ suffix (characters that are put after) for all blas function in the library (e.\-g. {\ttfamily \-\_\-})  
\item {\ttfamily A\-T\-L\-A\-S64\textbackslash{}desc} -\/ text description of the library.  
\end{DoxyItemize}

On Free\-Mat startup it looks at the blas.\-ini file, and tries to load each library described in the section for the given O\-S flavor. Free\-Mat will use the first library it can successfully load. If you want to switch the B\-L\-A\-S libraries dynamically in the running Free\-Mat session you need to use blaslib command.

If Free\-Mat can't load any library it will default to using built in B\-L\-A\-S.

You should be a careful when using non-\/default B\-L\-A\-S libraries. Some libraries do not implement all the B\-L\-A\-S functions correctly. You should run Free\-Mat test suite (type {\ttfamily run\-\_\-tests()}) and use common sense when evaluating the results of numerical computations. \hypertarget{freemat_builtin}{}\section{B\-U\-I\-L\-T\-I\-N Evaulate Builtin Function}\label{freemat_builtin}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily builtin} function evaluates a built in function with the given name, bypassing any overloaded functions. The syntax of {\ttfamily builtin} is \begin{DoxyVerb}  [y1,y2,...,yn] = builtin(fname,x1,x2,...,xm)
\end{DoxyVerb}
 where {\ttfamily fname} is the name of the function to call. Apart from the fact that {\ttfamily fname} must be a string, and that {\ttfamily builtin} always calls the non-\/overloaded method, it operates exactly like {\ttfamily feval}. Note that unlike M\-A\-T\-L\-A\-B, {\ttfamily builtin} does not force evaluation to an actual compiled function. It simply subverts the activation of overloaded method calls. \hypertarget{freemat_clc}{}\section{C\-L\-C Clear Dislplay}\label{freemat_clc}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily clc} function clears the current display. The syntax for its use is \begin{DoxyVerb}   clc
\end{DoxyVerb}
 \hypertarget{freemat_clock}{}\section{C\-L\-O\-C\-K Get Current Time}\label{freemat_clock}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
Returns the current date and time as a vector. The syntax for its use is \begin{DoxyVerb}   y = clock
\end{DoxyVerb}
 where {\ttfamily y} has the following format\-: \begin{DoxyVerb}   y = [year month day hour minute seconds]
\end{DoxyVerb}
 \hypertarget{variables_struct_Example}{}\subsection{Example}\label{variables_struct_Example}
Here is the time that this manual was last built\-:


\begin{DoxyVerbInclude}
--> clock

ans = 

   1.0e+03 * 
    2.0120    0.0020    0.0080    0.0220    0.0420    0.0412 
\end{DoxyVerbInclude}
 \hypertarget{freemat_clocktotime}{}\section{C\-L\-O\-C\-K\-T\-O\-T\-I\-M\-E Convert Clock Vector to Epoch Time}\label{freemat_clocktotime}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
Given the output of the {\ttfamily clock} command, this function computes the epoch time, i.\-e, the time in seconds since January 1,1970 at 00\-:00\-:00 U\-T\-C. This function is most useful for calculating elapsed times using the clock, and should be accurate to less than a millisecond (although the true accuracy depends on accuracy of the argument vector). The usage for {\ttfamily clocktotime} is \begin{DoxyVerb}   y = clocktotime(x)
\end{DoxyVerb}
 where {\ttfamily x} must be in the form of the output of {\ttfamily clock}, that is \begin{DoxyVerb}   x = [year month day hour minute seconds]
\end{DoxyVerb}
 \hypertarget{variables_struct_Example}{}\subsection{Example}\label{variables_struct_Example}
Here is an example of using {\ttfamily clocktotime} to time a delay of 1 second


\begin{DoxyVerbInclude}
--> x = clock

x = 

   1.0e+03 * 
    2.0120    0.0020    0.0080    0.0220    0.0420    0.0415 

--> sleep(1)
--> y = clock

y = 

   1.0e+03 * 
    2.0120    0.0020    0.0080    0.0220    0.0420    0.0425 

--> clocktotime(y) - clocktotime(x)

ans = 
    1.0010 
\end{DoxyVerbInclude}
 \hypertarget{freemat_computer}{}\section{C\-O\-M\-P\-U\-T\-E\-R Computer System Free\-Mat is Running On}\label{freemat_computer}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
Returns a string describing the name of the system Free\-Mat is running on. The exact value of this string is subject to change, although the {\ttfamily 'M\-A\-C'} and {\ttfamily 'P\-C\-W\-I\-N'} values are probably fixed. \begin{DoxyVerb}  str = computer
\end{DoxyVerb}
 Currently, the following return values are defined 
\begin{DoxyItemize}
\item {\ttfamily 'P\-C\-W\-I\-N'} -\/ M\-S Windows  
\item {\ttfamily 'M\-A\-C'} -\/ Mac O\-S X  
\item {\ttfamily 'U\-N\-I\-X'} -\/ All others  
\end{DoxyItemize}\hypertarget{freemat_diary}{}\section{D\-I\-A\-R\-Y Create a Log File of Console}\label{freemat_diary}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily diary} function controls the creation of a log file that duplicates the text that would normally appear on the console. The simplest syntax for the command is simply\-: \begin{DoxyVerb}   diary
\end{DoxyVerb}
 which toggles the current state of the diary command. You can also explicitly set the state of the diary command via the syntax \begin{DoxyVerb}   diary off
\end{DoxyVerb}
 or \begin{DoxyVerb}   diary on
\end{DoxyVerb}
 To specify a filename for the log (other than the default of {\ttfamily diary}), you can use the form\-: \begin{DoxyVerb}   diary filename
\end{DoxyVerb}
 or \begin{DoxyVerb}   diary('filename')
\end{DoxyVerb}
 which activates the diary with an output filename of {\ttfamily filename}. Note that the {\ttfamily diary} command is thread specific, but that the output is appended to a given file. That means that if you call {\ttfamily diary} with the same filename on multiple threads, their outputs will be intermingled in the log file (just as on the console). Because the {\ttfamily diary} state is tied to individual threads, you cannot retrieve the current diary state using the {\ttfamily get(0,'Diary')} syntax from M\-A\-T\-L\-A\-B. Instead, you must call the {\ttfamily diary} function with no inputs and one output\-: \begin{DoxyVerb}   state = diary
\end{DoxyVerb}
 which returns a logical {\ttfamily 1} if the output of the current thread is currently going to a diary, and a logical {\ttfamily 0} if not. \hypertarget{freemat_docli}{}\section{D\-O\-C\-L\-I Start a Command Line Interface}\label{freemat_docli}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily docli} function is the main function that you interact with when you run Free\-Mat. I am not sure why you would want to use it, but hey -\/ its there if you want to use it. \hypertarget{freemat_edit}{}\section{E\-D\-I\-T Open Editor Window}\label{freemat_edit}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
Brings up the editor window. The arguments of {\ttfamily edit} function are names of files for editing\-: \begin{DoxyVerb}  edit file1 file2 file3
\end{DoxyVerb}
 \hypertarget{freemat_editor}{}\section{E\-D\-I\-T\-O\-R Open Editor Window}\label{freemat_editor}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
Brings up the editor window. The {\ttfamily editor} function takes no arguments\-: \begin{DoxyVerb}  editor
\end{DoxyVerb}
 \hypertarget{freemat_errorcount}{}\section{E\-R\-R\-O\-R\-C\-O\-U\-N\-T Retrieve the Error Counter for the Interpreter}\label{freemat_errorcount}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
This routine retrieves the internal counter for the interpreter, and resets it to zero. The general syntax for its use is \begin{DoxyVerb}   count = errorcount
\end{DoxyVerb}
 \hypertarget{freemat_etime}{}\section{E\-T\-I\-M\-E Elapsed Time Function}\label{freemat_etime}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily etime} calculates the elapsed time between two {\ttfamily clock} vectors {\ttfamily x1} and {\ttfamily x2}. The syntax for its use is \begin{DoxyVerb}   y = etime(x1,x2)
\end{DoxyVerb}
 where {\ttfamily x1} and {\ttfamily x2} are in the {\ttfamily clock} output format \begin{DoxyVerb}   x = [year month day hour minute seconds]
\end{DoxyVerb}
 \hypertarget{variables_struct_Example}{}\subsection{Example}\label{variables_struct_Example}
Here we use {\ttfamily etime} as a substitute for {\ttfamily tic} and {\ttfamily toc}


\begin{DoxyVerbInclude}
--> x1 = clock;
--> sleep(1);
--> x2 = clock;
--> etime(x2,x1);
\end{DoxyVerbInclude}
 \hypertarget{freemat_eval}{}\section{E\-V\-A\-L Evaluate a String}\label{freemat_eval}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily eval} function evaluates a string. The general syntax for its use is \begin{DoxyVerb}   eval(s)
\end{DoxyVerb}
 where {\ttfamily s} is the string to evaluate. If {\ttfamily s} is an expression (instead of a set of statements), you can assign the output of the {\ttfamily eval} call to one or more variables, via \begin{DoxyVerb}   x = eval(s)
   [x,y,z] = eval(s)
\end{DoxyVerb}


Another form of {\ttfamily eval} allows you to specify an expression or set of statements to execute if an error occurs. In this form, the syntax for {\ttfamily eval} is \begin{DoxyVerb}   eval(try_clause,catch_clause),
\end{DoxyVerb}
 or with return values, \begin{DoxyVerb}   x = eval(try_clause,catch_clause)
   [x,y,z] = eval(try_clause,catch_clause)
\end{DoxyVerb}
 These later forms are useful for specifying defaults. Note that both the {\ttfamily try\-\_\-clause} and {\ttfamily catch\-\_\-clause} must be expressions, as the equivalent code is \begin{DoxyVerb}  try
    [x,y,z] = try_clause
  catch
    [x,y,z] = catch_clause
  end
\end{DoxyVerb}
 so that the assignment must make sense in both cases. \hypertarget{variables_struct_Example}{}\subsection{Example}\label{variables_struct_Example}
Here are some examples of {\ttfamily eval} being used.


\begin{DoxyVerbInclude}
--> eval('a = 32')

a = 
 32 

--> b = eval('a')

b = 
 32 
\end{DoxyVerbInclude}


The primary use of the {\ttfamily eval} statement is to enable construction of expressions at run time.


\begin{DoxyVerbInclude}
--> s = ['b = a' ' + 2']

s = 
b = a + 2
--> eval(s)

b = 
 34 
\end{DoxyVerbInclude}


Here we demonstrate the use of the catch-\/clause to provide a default value


\begin{DoxyVerbInclude}
--> a = 32

a = 
 32 

--> b = eval('a','1')

b = 
 32 

--> b = eval('z','a+1')

b = 
 33 
\end{DoxyVerbInclude}


Note that in the second case, {\ttfamily b} takes the value of 33, indicating that the evaluation of the first expression failed (because {\ttfamily z} is not defined). \hypertarget{freemat_evalin}{}\section{E\-V\-A\-L\-I\-N Evaluate a String in Workspace}\label{freemat_evalin}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily evalin} function is similar to the {\ttfamily eval} function, with an additional argument up front that indicates the workspace that the expressions are to be evaluated in. The various syntaxes for {\ttfamily evalin} are\-: \begin{DoxyVerb}   evalin(workspace,expression)
   x = evalin(workspace,expression)
   [x,y,z] = evalin(workspace,expression)
   evalin(workspace,try_clause,catch_clause)
   x = evalin(workspace,try_clause,catch_clause)
   [x,y,z] = evalin(workspace,try_clause,catch_clause)
\end{DoxyVerb}
 The argument {\ttfamily workspace} must be either 'caller' or 'base'. If it is 'caller', then the expression is evaluated in the caller's work space. That does not mean the caller of {\ttfamily evalin}, but the caller of the current function or script. On the other hand if the argument is 'base', then the expression is evaluated in the base work space. See {\ttfamily eval} for details on the use of each variation. \hypertarget{freemat_exit}{}\section{E\-X\-I\-T Exit Program}\label{freemat_exit}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The usage is \begin{DoxyVerb}   exit
\end{DoxyVerb}
 Quits Free\-Mat. This script is a simple synonym for {\ttfamily quit}. \hypertarget{freemat_feval}{}\section{F\-E\-V\-A\-L Evaluate a Function}\label{freemat_feval}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily feval} function executes a function using its name. The syntax of {\ttfamily feval} is \begin{DoxyVerb}  [y1,y2,...,yn] = feval(f,x1,x2,...,xm)
\end{DoxyVerb}
 where {\ttfamily f} is the name of the function to evaluate, and {\ttfamily xi} are the arguments to the function, and {\ttfamily yi} are the return values.

Alternately, {\ttfamily f} can be a function handle to a function (see the section on {\ttfamily function handles} for more information).

Finally, Free\-Mat also supports {\ttfamily f} being a user defined class in which case it will atttempt to invoke the {\ttfamily subsref} method of the class. \hypertarget{variables_struct_Example}{}\subsection{Example}\label{variables_struct_Example}
Here is an example of using {\ttfamily feval} to call the {\ttfamily cos} function indirectly.


\begin{DoxyVerbInclude}
--> feval('cos',pi/4)

ans = 
    0.7071 
\end{DoxyVerbInclude}


Now, we call it through a function handle


\begin{DoxyVerbInclude}
--> c = @cos

c = 
 @cos
--> feval(c,pi/4)

ans = 
    0.7071 
\end{DoxyVerbInclude}


Here we construct an inline object (which is a user-\/defined class) and use {\ttfamily feval} to call it


\begin{DoxyVerbInclude}
--> afunc = inline('cos(t)+sin(t)','t')

afunc = 
  inline function object
  f(t) = cos(t)+sin(t)
--> feval(afunc,pi)

ans = 
   -1.0000 

--> afunc(pi)

ans = 
   -1.0000 
\end{DoxyVerbInclude}


In both cases, (the {\ttfamily feval} call and the direct invokation), Free\-Mat calls the {\ttfamily subsref} method of the class, which computes the requested function. \hypertarget{freemat_filesep}{}\section{F\-I\-L\-E\-S\-E\-P Directory Separation Character}\label{freemat_filesep}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily filesep} routine returns the character used to separate directory names on the current platform (basically, a forward slash for Windows, and a backward slash for all other O\-Ses). The syntax is simple\-: \begin{DoxyVerb}  x = filesep
\end{DoxyVerb}
 \hypertarget{freemat_help}{}\section{H\-E\-L\-P Help}\label{freemat_help}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
Displays help on a function available in Free\-Mat. The help function takes one argument\-: \begin{DoxyVerb}  help topic
\end{DoxyVerb}
 where {\ttfamily topic} is the topic to look for help on. For scripts, the result of running {\ttfamily help} is the contents of the comments at the top of the file. If Free\-Mat finds no comments, then it simply displays the function declaration. \hypertarget{freemat_helpwin}{}\section{H\-E\-L\-P\-W\-I\-N Online Help Window}\label{freemat_helpwin}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
Brings up the online help window with the Free\-Mat manual. The {\ttfamily helpwin} function takes no arguments\-: \begin{DoxyVerb}  helpwin
  helpwin FunctionName
\end{DoxyVerb}
 \hypertarget{freemat_jitcontrol}{}\section{J\-I\-T\-C\-O\-N\-T\-R\-O\-L Control the Just In Time Compiler}\label{freemat_jitcontrol}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily jitcontrol} functionality in Free\-Mat allows you to control the use of the Just In Time (J\-I\-T) compiler. Starting in Free\-Mat version 4, the J\-I\-T compiler is enabled by default on all platforms where it is successfully built. The J\-I\-T compiler should significantly improve the performance of loop intensive, scalar code. As development progresses, more and more functionality will be enabled under the J\-I\-T. In the mean time (if you use the G\-U\-I version of Free\-Mat) you can use the J\-I\-T chat window to get information on why your code was J\-I\-T compiled (or not). \hypertarget{freemat_mfilename}{}\section{M\-F\-I\-L\-E\-N\-A\-M\-E Name of Current Function}\label{freemat_mfilename}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
Returns a string describing the name of the current function. For M-\/files this string will be the complete filename of the function. This is true even for subfunctions. The syntax for its use is \begin{DoxyVerb}    y = mfilename
\end{DoxyVerb}
 \hypertarget{freemat_path}{}\section{P\-A\-T\-H Get or Set Free\-Mat Path}\label{freemat_path}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily path} routine has one of the following syntaxes. In the first form \begin{DoxyVerb}  x = path
\end{DoxyVerb}
 {\ttfamily path} simply returns the current path. In the second, the current path is replaced by the argument string {\ttfamily 'thepath'} \begin{DoxyVerb}  path('thepath')
\end{DoxyVerb}
 In the third form, a new path is appended to the current search path \begin{DoxyVerb}  path(path,'newpath')
\end{DoxyVerb}
 In the fourth form, a new path is prepended to the current search path \begin{DoxyVerb}  path('newpath',path)
\end{DoxyVerb}
 In the final form, the path command prints out the current path \begin{DoxyVerb}  path
\end{DoxyVerb}
 \hypertarget{freemat_pathsep}{}\section{P\-A\-T\-H\-S\-E\-P Path Directories Separation Character}\label{freemat_pathsep}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily pathsep} routine returns the character used to separate multiple directories on a path string for the current platform (basically, a semicolon for Windows, and a regular colon for all other O\-Ses). The syntax is simple\-: \begin{DoxyVerb}  x = pathsep
\end{DoxyVerb}
 \hypertarget{freemat_pathtool}{}\section{P\-A\-T\-H\-T\-O\-O\-L Open Path Setting Tool}\label{freemat_pathtool}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
Brings up the pathtool dialog. The {\ttfamily pathtool} function takes no arguments\-: \begin{DoxyVerb}  pathtool
\end{DoxyVerb}
 \hypertarget{freemat_pcode}{}\section{P\-C\-O\-D\-E Convert a Script or Function to P-\/\-Code}\label{freemat_pcode}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
Writes out a script or function as a P-\/code function. The general syntax for its use is\-: \begin{DoxyVerb}   pcode fun1 fun2 ...
\end{DoxyVerb}
 The compiled functions are written to the current directory. \hypertarget{freemat_profiler}{}\section{P\-R\-O\-F\-I\-L\-E\-R Control Profiling}\label{freemat_profiler}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily profile} function allows you to control the Free\-Mat profiler. It has two modes of operation. The first is to enable-\/disable the profiler. To turn on profiling\-: \begin{DoxyVerb}  profiler on
\end{DoxyVerb}
 to turn off profiling, use \begin{DoxyVerb}  profiler off
\end{DoxyVerb}
 Note that regardless of the state of the profiler, only functions and scripts are profiled. Commands entered on the command line are not profiled. To see information that has accumulated in a profile, you use the variant of the command\-: \begin{DoxyVerb}  profiler list
\end{DoxyVerb}
 which lists current sorted profiling resuls. You can use this form to obtain profiler results as a cell array \begin{DoxyVerb}  r=profiler('list')
\end{DoxyVerb}
 If you want to see current profile status issue a {\ttfamily profile} command with no arguments. \begin{DoxyVerb}   profiler
\end{DoxyVerb}
 \hypertarget{freemat_quiet}{}\section{Q\-U\-I\-E\-T Control the Verbosity of the Interpreter}\label{freemat_quiet}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily quiet} function controls how verbose the interpreter is when executing code. The syntax for the function is \begin{DoxyVerb}   quiet flag
\end{DoxyVerb}
 where {\ttfamily flag} is one of 
\begin{DoxyItemize}
\item {\ttfamily 'normal'} -\/ normal output from the interpreter  
\item {\ttfamily 'quiet'} -\/ only intentional output (e.\-g. {\ttfamily printf} calls and {\ttfamily disp} calls) is printed. The output of expressions that are not terminated in semicolons are not printed.  
\item {\ttfamily 'silent'} -\/ nothing is printed to the output.  
\end{DoxyItemize}The {\ttfamily quiet} command also returns the current quiet flag. \hypertarget{freemat_quit}{}\section{Q\-U\-I\-T Quit Program}\label{freemat_quit}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily quit} statement is used to immediately exit the Free\-Mat application. The syntax for its use is \begin{DoxyVerb}   quit
\end{DoxyVerb}
 \hypertarget{freemat_rehash}{}\section{R\-E\-H\-A\-S\-H Rehash Directory Caches}\label{freemat_rehash}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
Usually, Free\-Mat will automatically determine when M Files have changed, and pick up changes you have made to M files. Sometimes, you have to force a refresh. Use the {\ttfamily rehash} command for this purpose. The syntax for its use is \begin{DoxyVerb}  rehash
\end{DoxyVerb}
 \hypertarget{freemat_rescan}{}\section{R\-E\-S\-C\-A\-N Rescan M Files for Changes}\label{freemat_rescan}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
Usually, Free\-Mat will automatically determine when M Files have changed, and pick up changes you have made to M files. Sometimes, you have to force a refresh. Use the {\ttfamily rescan} command for this purpose. The syntax for its use is \begin{DoxyVerb}  rescan
\end{DoxyVerb}
 \hypertarget{freemat_rootpath}{}\section{R\-O\-O\-T\-P\-A\-T\-H Set Free\-Mat Root Path}\label{freemat_rootpath}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
In order to function properly, Free\-Mat needs to know where to find the {\ttfamily toolbox} directory as well as the {\ttfamily help} directory. These directories are located on what is known as the {\ttfamily root path}. Normally, Free\-Mat should know where these directories are located. However under some circumstances (usually when Free\-Mat is installed into a non-\/default location), it may be necessary to indicate a different root path location, or to specify a particular one. Note that on the Mac O\-S platform, Free\-Mat is installed as a bundle, and will use the toolbox that is installed in the bundle regardless of the setting for {\ttfamily rootpath}. For Linux, Free\-Mat will typically use {\ttfamily /usr/local/share/\-Free\-Mat-\/$<$Version$>$/} for the root path. Installations from source code will generally work, but binary installations (e.\-g., from an {\ttfamily R\-P\-M}) may need to have the rootpath set.

The {\ttfamily rootpath} function has two forms. The first form takes no arguments and returns the current root path \begin{DoxyVerb}   rootpath
\end{DoxyVerb}
 The second form will set a rootpath directly from the command line \begin{DoxyVerb}   rootpath(path)
\end{DoxyVerb}
 where {\ttfamily path} is the full path to where the {\ttfamily toolbox} and {\ttfamily help} directories are located. For example, {\ttfamily rootpath('/usr/share/\-Free\-Mat-\/4.0')}. The third form enables the G\-U\-I form \begin{DoxyVerb}   rootpath gui
\end{DoxyVerb}
 which activates a dialog box to pick a directory that is the root directory of the Free\-Mat installation (e.\-g., where {\ttfamily help} and {\ttfamily toolbox} are located. Changes to {\ttfamily rootpath} are persistent (you do not need to run it every time you start Free\-Mat). \hypertarget{freemat_saveretvalue}{}\section{S\-A\-V\-E\-R\-E\-T\-V\-A\-L\-U\-E Save Return Value Of Function}\label{freemat_saveretvalue}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
saves the given argument value for return when Free\-Mat (the application) exits. \hypertarget{freemat_simkeys}{}\section{S\-I\-M\-K\-E\-Y\-S Simulate Keypresses from the User}\label{freemat_simkeys}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
This routine simulates keystrokes from the user on Free\-Mat. The general syntax for its use is \begin{DoxyVerb}   otext = simkeys(text)
\end{DoxyVerb}
 where {\ttfamily text} is a string to simulate as input to the console. The output of the commands are captured and returned in the string {\ttfamily otext}. This is primarily used by the testing infrastructure. \hypertarget{freemat_sleep}{}\section{S\-L\-E\-E\-P Sleep For Specified Number of Seconds}\label{freemat_sleep}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
Suspends execution of Free\-Mat for the specified number of seconds. The general syntax for its use is \begin{DoxyVerb}  sleep(n),
\end{DoxyVerb}
 where {\ttfamily n} is the number of seconds to wait. \hypertarget{freemat_source}{}\section{S\-O\-U\-R\-C\-E Execute an Arbitrary File}\label{freemat_source}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily source} function executes the contents of the given filename one line at a time (as if it had been typed at the {\ttfamily --$>$} prompt). The {\ttfamily source} function syntax is \begin{DoxyVerb}  source(filename)
\end{DoxyVerb}
 where {\ttfamily filename} is a {\ttfamily string} containing the name of the file to process. \hypertarget{variables_struct_Example}{}\subsection{Example}\label{variables_struct_Example}
First, we write some commands to a file (note that it does not end in the usual {\ttfamily .m} extension)\-:

\begin{DoxyVerb}     source_test
\end{DoxyVerb}



\begin{DoxyVerbInclude}
a = 32;
b = a;
printf('a is %d and b is %d\n',a,b);
\end{DoxyVerbInclude}


Now we source the resulting file.


\begin{DoxyVerbInclude}
--> clear a b
--> source source_test
a is 32 and b is 32
\end{DoxyVerbInclude}
 \hypertarget{freemat_startup}{}\section{S\-T\-A\-R\-T\-U\-P Startup Script}\label{freemat_startup}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
Upon starting, Free\-Mat searches for a script names {\ttfamily startup.\-m}, and if it finds it, it executes it. This script can be in the current directory, or on the Free\-Mat path (set using {\ttfamily setpath}). The contents of startup.\-m must be a valid script (not a function). \hypertarget{freemat_tic}{}\section{T\-I\-C Start Stopwatch Timer}\label{freemat_tic}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
Starts the stopwatch timer, which can be used to time tasks in Free\-Mat. The {\ttfamily tic} takes no arguments, and returns no outputs. You must use {\ttfamily toc} to get the elapsed time. The usage is \begin{DoxyVerb}  tic
\end{DoxyVerb}
 \hypertarget{variables_struct_Example}{}\subsection{Example}\label{variables_struct_Example}
Here is an example of timing the solution of a large matrix equation.


\begin{DoxyVerbInclude}
--> A = rand(100);
--> b = rand(100,1);
--> tic; c = A\b; toc

ans = 
    0.0050 
\end{DoxyVerbInclude}
 \hypertarget{freemat_toc}{}\section{T\-O\-C Stop Stopwatch Timer}\label{freemat_toc}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
Stop the stopwatch timer, which can be used to time tasks in Free\-Mat. The {\ttfamily toc} function takes no arguments, and returns no outputs. You must use {\ttfamily toc} to get the elapsed time. The usage is \begin{DoxyVerb}  toc
\end{DoxyVerb}
 \hypertarget{variables_struct_Example}{}\subsection{Example}\label{variables_struct_Example}
Here is an example of timing the solution of a large matrix equation.


\begin{DoxyVerbInclude}
--> A = rand(100);
--> b = rand(100,1);
--> tic; c = A\b; toc

ans = 
    0.0050 
\end{DoxyVerbInclude}
 \hypertarget{freemat_version}{}\section{V\-E\-R\-S\-I\-O\-N The Current Version Number}\label{freemat_version}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily version} function returns the current version number for Free\-Mat (as a string). The general syntax for its use is \begin{DoxyVerb}    v = version
\end{DoxyVerb}
 \hypertarget{variables_struct_Example}{}\subsection{Example}\label{variables_struct_Example}
The current version of Free\-Mat is


\begin{DoxyVerbInclude}
--> version

ans = 
4.2
\end{DoxyVerbInclude}
 \hypertarget{freemat_verstring}{}\section{V\-E\-R\-S\-T\-R\-I\-N\-G The Current Version String}\label{freemat_verstring}
Section\-: \hyperlink{sec_freemat}{Free\-Mat Functions} \hypertarget{vtkwidgets_vtkxyplotwidget_Usage}{}\subsection{Usage}\label{vtkwidgets_vtkxyplotwidget_Usage}
The {\ttfamily verstring} function returns the current version string for Free\-Mat. The general syntax for its use is \begin{DoxyVerb}    version = verstring
\end{DoxyVerb}
 \hypertarget{variables_struct_Example}{}\subsection{Example}\label{variables_struct_Example}
The current version of Free\-Mat is


\begin{DoxyVerbInclude}
--> verstring

ans = 
FreeMat v4.2
\end{DoxyVerbInclude}
 