Matlab FAQ
Feel free to add your own hints about Matlab and information about your own m-functions that could be useful to others.
Miscellaneous:
Matlab graphics:
Run it from sthelens, and only if sthelens is down, from cher, orsay or tiree. It works on other machines too, but some of the other machines have older versions of the OS and core dump upon exiting from matlab. Some other local machines with new setups work fine. Try your local machine. Matlab is blocked from running on the servers (koko and okok).
There can be three reasons for Matlab not to start:
If koko is misbehaving and you need Matlab, of if all five licenses are taken and nobody would close their session, or if you need toolboxes we don't have, you can use the university's machines. Here's how.
Definitions:
Procedure:
The -nosplash -nojvm options will make Matlab start and run faster. It works without them too, if you like the luxury of a GUI. Among the remote machines above, tree was the fastest, but maybe I just caught it in a good mood.
The remote machines see your directory on the Leland systems. To transfer files to and from the current SEP system directory to the Leland directory, use sftp from koko or from your local machine:
sftp <user>@<remote>
After you started sftp, use put to transfer a file from the SEP current directory to the Leland systems home directory: put <filename> , and get to retrieve a file: get <filename> .
You can also use scp <files_here> <username_there>@<machinename>:<path_to_files_there>, either from the local machine to the remote one, or the other way around.
If you need to read/write SEPlib format files from Matlab when running Matlab outside the SEP computing system, download the I/O toolbox and unarchive it with tar -xvzf toolbox.tar.gz or copy it from /usr/local/matlab7/toolbox/nick/. Let the Matlab Administrator know of any bugs, he'll appreciate the feedback. Solving them, or extending the capabilities of the toolbox to handle other OSs than Linux are even more appreciated.
can be found at www.mathworks.com/access/helpdesk/help/helpdesk.shtml. It is much richer than the simple line-of-command help, it has examples, pictures, and tutorials on how to use each of the toolboxes. The search feature is also quite useful, it searches through their pdf documents and through the user-posed questions, too.
In the SEP reproducibility denomination system, Matlab figures are considered Conditionally Reproducible because they require a proprietary software package (matlab). There are two degrees of reproducibility:
figurename;
print -depsc2 junk_ml.ps
Note that the output file must always be called junk_ml.ps. If you do things this way, you do not need to write any rule for the target figurename in the Makefile. It is only necessary to specify the figure on the RESULTSCR list in the makefile, and the makerules will take care of the rest.
Why is it done like that: I know it looks cumbersome, but this is in the Object Oriented spirit: the actual writing of the figure to disk is separated from the process of creating it, so if one day we decide we need the matlab scripts to produce jpeg or tiff figures we only have to write a simple perl script which will change the .ml files. And having a single main script for each figure, with the same name as the figure helps others understand what's in there. The targets are always named junk_ml.ps in the makefile so that if you change the figurename, you do not have to edit matlab files as well.
Troubleshooting the Matlab makerules: If the make rules "do not understand" that they are supposed to produce a matlab target without a rule, you can write a rule for a CR target in your makefile in the following way:
${RESDIR}/figurename.ps: $(MATLABDIR)/figurename.m \
$(MATLABDIR)/figurename.ml
_TAB_here_@-cd $(MATLABDIR); matlab < figurename.ml
_TAB_here_mv $(MATLABDIR)/junk_ml.ps $@
_TAB_here_echo 'In order to produce this figure you need Matlab' > ${RESDIR}/figurename.warning
PROBLEM:On the new Matlab 6.0, when running a command such as surf, that produced a 3D display, the thing would take a huge time to display, or would crash, and sometimes the following error would appear:
"Xlib: extension "GLX" missing on display "nada.Stanford.EDU:0.0".
??? Not able to create a render context" .
SOLUTION: If before running your surf command you run: set(gcf,'renderer','zbuffer'), the 3D image will display correctly and very fast, too.
From: Biondo
Add the following line line before outputting the tiff file, and make sure to run 'xhost + ashland' on santorin console before creating the figure.set (gcf,'XDisplay','santorin.stanford.edu:0.0')
figure;
set(gcf,'renderer','zbuffer');
[s,w] = unix('echo $DISPLAY');
set(gcf,'XDisplay',w);
Recently, I gave Matlab a job that required it to go through roughly 400 iterations. The job involved adding some numbers into a big matrix, nothing complex. To my surprise, after 10 hours, it still had not finished running.
I had matlab display a iteration counter. The speed of iteration slowed down fast after the first iterations, and I knew there were no convergence problems, so Matlab was sabotaging itself. I included the coomand pack inside the loop, and the program executed in five minutes what previously had not been able to do in 10 hours!
% setenv DISPLAY /dev/null
% matlab
|
Department of Geophysics Stanford University |
|