software:matlab:mills

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
software:matlab:mills [2019-08-29 16:05] – [Matlab function] anitasoftware:matlab:mills [2019-08-29 16:05] (current) – [Matlab script] anita
Line 137: Line 137:
 quit quit
 </file> </file>
 +
 +This is a detailed script example, which calls the maxEig function.  This example does no file I/O, all the I/O is to standard out.  In Matlab, assignments, not terminated by a semicolon, are display on the screen (standard out in batch).
 +
 +<note tip>
 +Several MATLAB commands could be added to the beginning of this script to set the maximum number of computational threads to the number of slots assigned to your job.  If the scheduler using CGROUPS to limit your job core count, then these commands are not necessary.
 +<code>
 +[compThreads,count]=sscanf(getenv('NSLOTS'),'%d');
 +if count == 1 
 +  warning('off','MATLAB:maxNumCompThreads:Deprecated');
 +  autoCompThreads = maxNumCompThreads(compThreads);
 +  disp(sprintf('NumCompThreads=%d, was %d',compThreads,autoCompThreads))
 +end
 +</code>
 +See [[maxNumCompThreadsGridEngine|Setting maximum number of computational threads]]</note>
 +
 +<note tip>
 +This script ends in a **__quit__** command (equivalent to MATLAB **__exit__**).  This is meant to be a complete script, which
 +terminates MATLAB when done.  If you run this from the bash command line with the ''-r script'' option, it will come back with a bash prompt when completed.  If this is run from a batch job, then you can do other commands in your batch script after the MATLAB script completes.
 +
 +Without the **__quit__** you will come back to the MATLAB prompt on completion for a interactive job.  If this is the last line of a batch queue script, then the only difference will be the MATLAB prompt ''>>'' at the very end of the output file.  MATLAB treats the end of batch script file the same as exiting the window, which is the preferred way to exit the MATLAB GUI.
 +</note>
  
 ==== Grid Engine script ==== ==== Grid Engine script ====
  • software/matlab/mills.1567109112.txt.gz
  • Last modified: 2019-08-29 16:05
  • by anita