MATLAB

What can I do when I get a "FLEXnet Licensing error"?

The UCSD MATLAB license server may be having a problem.

Consult http://sdcc3.ucsd.edu/software/monitor-flexlm/index.php?selection=license.matlab.

If the web page above indicates that there are no licenses available or offers some strange error message, chances are the problem was already reported, but if you want to make sure, send a friendly message to software@ucsd.edu telling them the MATLAB license server may be having problems. If possible, copy and paste text from the above page as evidence.

If the status on the above page seems to indicate the license server is functioning, this may be due to a local configuration problem. In this case, please contact the SCCN system administrator.

How do I add another directory to my MATLABPATH?

If you are using Linux or Macintosh, open a terminal and type the following command to determine your shell.

$ echo $SHELL

csh

If your shell is csh (or tcsh), edit your .cshrc file and add this to the file, using your own paths to your functions:

if ( $?MATLABPATH ) then
if ( "${MATLABPATH}" !~ */path/to/functions* ) then
setenv MATLABPATH ${MATLABPATH}:/path/to/functions
endif
else
setenv MATLABPATH /path/to/functions
endif

If you want your functions to take priority over any other functions with the same name, list your path first, like this:

setenv MATLABPATH /path/to/functions:${MATLABPATH}

bash

If your shell is bash, edit your .bashrc file (vi .bashrc or emacs .bashrc) and add this line at the end of the file:

export MATLABPATH=$MATLABPATH:/path/to/your/functions

If you already have a MATLABPATH line in your .bashrc file, you can simply make changes to that line.

If you want your own functions to take priority over any other functions with the same name, put your path first, like this:

export MATLABPATH=/path/to/your/functions:$MATLABPATH

How can I export vector graphics that I can edit in Illustrator or Canvas

You must export to EPS file format in order to import into a vector graphics program such as Illustrator or Canvas.

Examples

print -depsc2 -adobecset -painter filename.eps

set(gcf, 'renderer', 'painter');
print -depsc2 filename.eps

For more information, see the EEGLAB page https://sccn.ucsd.edu/eeglab/printfig.html or The Mathworks page http://www.mathworks.com/help/techdoc/creating_plots/f3-103236.html.

How do I compile MATLAB functions?

This is how you can compile Matlab functions either to standalone functions or to mex-files (the latter are compiled functions which can be called from within MATLAB).

You need only two commands:

Make a C translation and a MEX-file for myfun.m:

% mcc -x myfun

Make a C translation and a stand-alone executable for myfun.m:

% mcc -m myfun

Appended is an example session for compiling the function bandfilt.m to 1) a mex-file bandfilt.mexglx, and 2) to a standalone function bandfilt. Compilation may not work for all m-functions, but you can try. On the particular function compiled below (which uses many loops), computation time was about 25% shorter.

>> ls

ans =

bandfilt.m


>> mcc -x bandfilt.m
>> ls

ans =

bandfilt.c  bandfilt.h  bandfilt.m  bandfilt_mex.c  bandfilt.mexglx  hanning.h


>> mcc -m bandfilt.m
>> ls

ans =

bandfilt    bandfilt.m       bandfilt.mexglx  signal_private_check_order.c
bandfilt.c  bandfilt_main.c  hanning.c        signal_private_check_order.h
bandfilt.h  bandfilt_mex.c   hanning.h