LSC MATLAB Applications
Links
Setting Environment variables for MatApps use
After checking out a version of the matapps repository from CVS, it is necessary to let MATLAB know where the matapps directories are located. To do this, in csh or tcsh, there is a shell script that can be sourced in the SDE directory of matapps. To use the shell script for csh or tcsh do:source ${MATAPPS_TOP}/SDE/matapps.cshrc ${MATAPPS_TOP}
for bash do:
source ${MATAPPS_TOP}/SDE/matapps.sh ${MATAPPS_TOP}
where ${MATAPPS_TOP} is the full path to the matapps directory. If you wish to not have to use this command repeatedly, add this line to your .cshrc file. This will add a MATAPPS_TOP and MATAPPS_SDE environment variable, as well as all of the matapps directories to your MATLABPATH. If, instead, you wish to add the matapps into your path while running in an interactive MATLAB session that did not have the MATLABPATH set, you may use:
${MATAPPS_TOP}/SDE/matapps_paths.m(${MATAPPS_TOP})
This will only add to the path for that particular session of MATLAB. Another alternative if you wish to have these paths always initialised on interactive startup (but not when running the compiler from the terminal or when using the make system!)is to add the following lines to the user's startup.m file:
verNum = str2num(version('-release'));
if(~isempty(verNum))
verOld = verNum < 14;
else
verOld = false;
end
if( (verOld == true) || (~isdeployed))
${MATAPPS_TOP}/SDE/matapps_paths.m(${MATAPPS_TOP})
end
clear verNum;
clear verOld;
This prevents the compiled executable from trying to use addpath, since this operation is redundant and can conflict with Release 14 and later use of expanded 'ctf' files. The tortured logic is required because as of Release 2006a, the version function returns a non-numeric string.
Adding New Directories
To add new directories to the list of matapps directories, one should edit the SDE/matapps_paths.txt file. This file is parsed by both the matapps.cshrc and matapps_paths.m to determine which files to add. This method was chosen as opposed to using the genpath function in matlab, since temporary directories (*_mcr) made by compiled MATLAB (Release 14 and later) executables in the directory that they are run from, will interfere with future compilation and need to be excluded from the MATLAB path. A more automated way of doing this would be nice, but has not been made at this time.Using the Makefile Scheme with MATLAB Release 14 and later
After setting up your environment, and making sure that you have gone through the "how to compile MATLAB" , it is possible to use make to compile the matapps executable files. The following commands may either be used with make in individual directories to make individual executables, or, if used in the top level directory to make all the executables. Typical usage would be "make clean", etc...| clean | clean up all temporary files and MATLAB executables from the directory. |
| matlab_exe | make all MATLAB executables. |
| exe | make all MATLAB executables and other executables. |
| mex | make mexglx files. |
| goals | for each item in ${GOALS} make it. |
| all | make mex exe docs test_exe goals; |
| test_exe | cd into the test directory and make all ${TESTS} executables. |
| test | make test_exe and then run the tests. |
| docs | cd into documentation directory and make all ${DOCS} files (.pdf and .ps files are presumed to come from .tex files) |
| install | copy MATLAB executables and .ctf files to ${MATLAB_USER_BIN}. copy other executables to ${USER_BIN} |
| update | recursively update all of matapps with cvs update -APdR (only in the ${MATLAB_TOP} directory) |
| env | printenv |
| pwd | pwd |
| matlab_path | run MATLAB and print the path within matlab. |
Adding new executables to make scheme
The best bet for doing this is to copy an existing Makefile and modify it. Basically, addinginclude ${MATAPPS_SDE}/default.mk
will set up the default make scheme and you will want to define the MATLAB_SRCS variable. For more advanced users, the following list of variables determine what and how things will be made:
| MATLAB_SRCS | list of MATLAB files that are to be made into executables. Other MATLAB files that are called from within these files do not need to be listed. |
| EXECUTABLES | non-matlab executables (such as shell scripts). |
| MCC_USER_OPTIONS | options to be used in the compiler (ie. '-R -nojvm -R -nojit -R -nodisplay') |
| DOCS | list of files to make within the documentation directory |
| TESTS | list of test files to make/run within the test directory |
| MEX_OPTIONS | options for compiling mex files |
| MEXGLX_FILES | the main mexglx file to be made (there should be an associated .c and .m file) |
| MEX_C_SRCS | other files to be included when making the the mexglx file |
| GOALS | other goals for make |
| MATLAB_USER_BIN | directory to copy MATLAB executables and .ctf files to, when installing. |
| USER_BIN | directory to copy all ${EXECUTABLES} files to, when installing. |
$Id: matapps_howto.html,v 1.21 2006/09/06 17:13:30 kathorne Exp $