mex sourcefile.c from within
MATLAB. Feel free to send me (via email) such missing binaries to
be included on this web page for others.headerdump(1)
for a simple example. Just about every possible type of variable
is supported, though some in more detail than others. Try copies
of variables, especially when cell arrays or structs are involved.
For instance, try copying a cell array with several elements.
Then modify a single element. Be creative!help ndfun for full
documentation and examples: NDFUN Matrix operations on N-D matrices
NDFUN treats an N-D matrix of double precision
values as a set of pages
of 2D matrices, and performs various matrix
operations on those pages.
The BLAS and LAPACK routines compiled into MATLAB
are used for all these
operations, so results will be very close, and are
usually identical, to
"native MATLAB results". Available commands
are:
C = NDFUN('mult', A, B)
C = NDFUN('backslash', A, B)
C = NDFUN('inv', A)
C = NDFUN('eig', A)
[C, D] = NDFUN('eig', A)
C = NDFUN('version')
The two-argument commands perform operations
equivalent to:
for i=1:N
C(:,:,i) = A(:,:,i) * B(:,:,i);
end
The one-argument command
for i=1:N
C(:,:,i) = inv(A(:,:,i));
end
Any number of dimensions is supported, but
dimensions > 2 must match:
C = ndfun('mult',
rand(4,3,2,2,2), rand(3,1,2,2,2))
C will have size = [4 1 2 2 2]
NDFUN will reuse 2D arguments when needed, much like
scalar
operations. A single 2D matrix can be
multiplied (or solved with)
each 2D page of the other argument. For
instance:
A = rand(4,3); B =
rand(3,10,100);
C = ndfun('mult', A, B);
is equivalent to:
for i=1:100
C(:,:,i) = A * B(:,:,i);
end
The reverse also works. These types of
operations are especially
efficient for the backslash operator.
Download from the NDFUN directory.
/* splitstr.c: MEX file that splits a string based an arbitrary
character
*
* C = SPLITSTR(S) splits the string S at newlines and returns a
cell
* array where each element is a word.
*
* C = SPLITSTR(S, DELIM) uses the character DELIM as the
delimiter.
* The strings '\n' and '\t' can be used to represent newline and
tab
* characters, respectively.
*
* Peter Boettcher <boettcher@ll.mit.edu>
* Copyright 2002
* Last modified: <Tue Jul 30 11:32:13 2002 by pwb>
*/
Here it is: splitstr.c
Drop the new avi.c into $MATLABROOT\toolbox\matlab\iofun\@avifile\private
(making appropriate backups of avi.c and avi.dll) and compile using:
mex avi.c aviutil.c vfw32.lib user32.lib