### Sidebar

Reference

computing:matlabsetup

NOTE: make sure you have completed the computing intro first.

## Setting up MATLAB

This assumes you have a working installation of MATLAB; if you want this on your own laptop, you can either find a working MATLAB install yourself, or ask mvdm to install the university's version; this requires a user account 'mvdmlab' and to be able to use it off-campus you need to set up a VPN.

If you haven't already done so, grab a snapshot of the lab codebase. You can either download the zip or set up a full GitHub install for continued synchronization.

Either way, choose a logical and easily accessed location for these files. For instance, I use D:\My_Documents\GitHub\vandermeerlab.

Open MATLAB and create a shortcut titled “vandermeerlab default path”. The code for the shortcut should be

restoredefaultpath;
cd('D:\My_Documents\scripts\vandermeerlab'); % or whatever you chose, obviously
p = genpath(pwd); % create list of all folders from here
p = regexprep(p,'C.*?\.git.*?;',''); % remove .git directory paths, we don't need these. Note: if your files are on the D drive, substitute 'D' for 'C'
addpath(p);

This ensures that whenever you click this button, you have a “clean” path of only the MATLAB default plus the basic vandermeerlab stuff.

For each project that you work on, either create a new, different button that has the main path plus whatever project-specific folders you need, or include a code snippet such as the above in the main scripts for that project.

So, if you are taking the “Analysis of Neural Data” course, I suggest creating a folder such as D:\My_Documents\projects\BIOL680\ (note, if you plan to work from multiple computers, consider placing this folder in your Dropbox). Within this folder, others such as daily and shared will be created later. Then, make a shortcut titled “BIOL680” as follows:

restoredefaultpath;
cd('D:\My_Documents\scripts\vandermeerlab'); % or whatever you chose, obviously
p = genpath(pwd); % create list of all folders from here
p = regexprep(p,'C.*?\.git.*?;',''); % remove .git directory paths, we don't need these
addpath(genpath(pwd));
Note the difference with the default path: it is identical except for the addition of whatever is in the shared project folder. In this way, you will be able to access your project code even if you are, for instance, in a data folder or in a daily folder.