1<?xml version="1.0" encoding="UTF-8"?> 2 3<section id="matlab"><title>Matlab Interface</title> 4 5<para>This is an interface to the 6 <ulink url="https://www.mathworks.com/help/matlab/calling-matlab-engine-from-c-programs-1.html">Matlab C API</ulink>.</para> 7 8<para>The package <quote role="package">MATLAB</quote> is &case-sensitive-k;, 9 so you would write <code>(matlab:engOpen ...)</code> 10 when you need to call <function role="matlab">engOpen</function>.</para> 11 12<simpara>When this module is present, &features-my; 13 contains the symbol <constant>:MATLAB</constant>.</simpara> 14 15<para>Additionally, some higher level functionality is available 16 (see <filename role="clisp-cvs">modules/matlab/test.tst</filename> 17 for sample usage):</para> 18 19<variablelist> 20<varlistentry id="matlab-matfile-content"> 21 <term><code>(matlab:matfile-content mf)</code></term> 22 <listitem><simpara>Return a &vector-t; of &string-t;s naming the 23 variables in file <replaceable>mf</replaceable> 24 (opened using <function role="matlab">matOpen</function>). 25</simpara></listitem></varlistentry> 26<varlistentry id="matlab-command"> 27 <term><varname>matlab:*command*</varname></term> 28 <listitem><simpara>The default argument to 29 <function role="matlab">engOpen</function>. 30</simpara></listitem></varlistentry> 31<varlistentry id="matlab-engine-v"> 32 <term><varname>matlab:*engine*</varname></term> 33 <listitem><simpara>The currrently open Matlab engine. 34</simpara></listitem></varlistentry> 35<varlistentry id="matlab-engine-f"><term><code>(matlab:engine)</code></term> 36 <listitem><simpara>Make sure <varname>*engine*</varname> is valid and 37 return it.</simpara></listitem></varlistentry> 38<varlistentry id="matlab-with-engine"><term><code>(matlab:with-engine 39 (&optional-amp; engine command) &body-amp; &body-r;)</code></term> 40 <listitem><simpara>Run the &body-r; wuth the <replaceable>engine</replaceable> 41 bound to a Matlab engine (default <varname>*engine*</varname>). 42 The engine is opened with <function role="matlab">engOpen</function>, 43 then closed with <function role="matlab">engClose</function>. 44</simpara></listitem></varlistentry> 45<varlistentry id="matlab-with-MATfile"><term><code>(matlab:with-MATfile 46 (file name &optional-amp; mode) &body-amp; &body-r;)</code></term> 47 <listitem><simpara><function role="matlab">matOpen</function> the 48 matlab file, do the &body-r;, <function role="matlab">matClose</function> 49 it.</simpara></listitem></varlistentry> 50<varlistentry id="copy-lisp-to-mxArray"><term><code>(matlab:copy-lisp-to-mxArray 51 lisp-array &optional-amp; matlab-matrix)</code></term> 52<listitem><simpara>Copy data from the 2-dimensional lisp array to the 53 Matlab matrix.</simpara></listitem></varlistentry> 54<varlistentry id="copy-lisp-to-matlab"><term><code>(matlab:copy-lisp-to-matlab 55 lisp-array matlab-variable &key-amp; engine)</code></term> 56<listitem><simpara>Copy the 2-dimensional lisp array to the Matlab 57 variable (a &string-t;) in the supplied engine (defaults to 58 <varname>*engine*</varname>).</simpara></listitem></varlistentry> 59<varlistentry id="copy-mxArray-to-lisp"><term><code>(matlab:copy-mxArray-to-lisp 60 matlab-matrix &optional-amp; lisp-array)</code></term> 61 <listitem><simpara>Copy the matlab matrix to the 2-dimensional lisp array 62 (created anew or re-used if supplied).</simpara></listitem></varlistentry> 63<varlistentry id="copy-matlab-to-lisp"><term><code>(matlab:copy-matlab-to-lisp 64 matlab-variable &optional-amp; lisp-array &key-amp; engine)</code></term> 65 <listitem><simpara>Copy data from the matlab variable to the 66 2-dimensional lisp array 67 (created anew or re-used if supplied).</simpara></listitem></varlistentry> 68<varlistentry id="matlab-invert-matrix"><term><code>(matlab:invert-matrix 69 lisp-array &key-amp; engine)</code></term> 70 <listitem><simpara>Invert the lisp matrix using the specified engine. 71</simpara></listitem></varlistentry> 72</variablelist> 73 74</section> 75