MATLAB

MATLAB 2023b and 2024a - Individual Licensing

Beginning with the 2023b version, MATLAB has shifted from device-based to individual licensing to individual licensing. This change necessitates authentication using your Dartmouth ID. When you first open MATLAB 2023b, you must authenticate using your Dartmouth email and DUO 2-step authentication. MATLAB will create a ".matlab" directory in your home folder to store authentication data. If this directory is deleted, you'll need to re-authenticate each time you start MATLAB.

You'll see your name at the top right of the Matlab window when you are logged in.

Matlab 2024a is also available in /thayerfs/apps - but you will need to load the module to run this version

$ module unload matlab
$ module load matlab/R2024a
		

Dartmouth College has a campus-wide site license for MATLAB from MathWorks. This site license permits students, faculty, and staff to install MATLAB on their own personal and Dartmouth/Thayer owned computers. This is a stand-alone license and does not require a connection to the Dartmouth network to run.

Installing MATLAB on your own computer

Download from Mathworks

Dartmouth's site-wide License allows for directly downloading from www.mathworks.com

Information on creating a MathWorks account and using MATLAB at Dartmouth is available at https://rcweb.dartmouth.edu/downloads/matlab/. From this page, click on the Site License Downloads link to find the actual Download and Installation instructions.

Using on Thayer Virtual Lab (Mac and Windows)

Access MATLAB by following the instructions for Virtual Computer Lab

Connect and run!

MATLAB Online

You can access a full-featured online version of MATLAB here: https://matlab.mathworks.com/

Keep in mind that you cannot access any ThayerFS, Jumbo or Google Drive data directly from the online version of MATLAB. You can upload to or download files from your MATLAB Drive here: https://drive.matlab.com/

Distributed computing with MATLAB

Information about parallel computing with the MATLAB Parallel Computing Toolbox is at:  https://www.mathworks.com/help/parallel-computing/

Documentation

MATLAB documentation is available online at:  https://www.mathworks.com/help/

Training

MATLAB training is provided each term by Research Computing. For more information, visit their Training page: https://rc.dartmouth.edu/index.php/training/

MathWorks offers training through their MATLAB Academy: https://matlabacademy.mathworks.com/

LinkedIn Learning has online training for MATLAB here: https://lil.dartmouth.edu/

Compiling

MATLAB programs can be compiled so that they can be run without using a license from Dartmouth's license server. Information about compiling MATLAB programs can be found here: https://www.mathworks.com/help/compiler/

Note that after you have compiled a MATLAB program on linux, you will need to alter some environment variables for the program to find the proper libraries:

export LD_LIBRARY_PATH=\
/thayerfs/apps/matlab/runtime/glnxa64:\
/thayerfs/apps/matlab/bin/glnxa64:\
/thayerfs/apps/matlab/sys/os/glnxa64:\
/thayerfs/apps/matlab/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:\
/thayerfs/apps/matlab/sys/java/jre/glnxa64/jre/lib/amd64/server:\
/thayerfs/apps/matlab/sys/java/jre/glnxa64/jre/lib/amd64
export XAPPLRESDIR=/thayerfs/apps/matlab/X11/app-defaults<br>
		

These commands can be executed manually, through a script, with an alias, etc., but must be run prior to running your compiled MATLAB program.

Updating/Re-Activating MATLAB License 

If your license is expiring or has expired, follow these instructions to update your license.

MATLAB Tricks

Saving results automatically

End Matlab Scripts with the save command. Code to save all variables in current session:

Filename = sprintf('results_%s.mat', datestr(now,'mm-dd-yyyy HH-MM'));
save(Filename)<br>
		

Command Window Font Size

Beginning with version 2022a, when using FastX the font in the Command Window is extremely small. To change the size of the font, first select Environment > Preferences from the toolbar:

Click Fonts on the left side, and change the size of the"Desktop code font" to a larger size:

This can also be done from within the Command Window itself (the default font size is 10):

s=settings()
s.matlab.fonts.codefont.Size.PersonalValue=14