Skip to content

Instantly share code, notes, and snippets.

@tsalo
Last active August 29, 2015 14:16
Show Gist options
  • Save tsalo/ca19fbf0a36880135116 to your computer and use it in GitHub Desktop.
Save tsalo/ca19fbf0a36880135116 to your computer and use it in GitHub Desktop.
Get directory of script. Add to the beginning of a script to help you load files in the same directory as the script. Makes projects more portable.
codeFile = mfilename('fullpath');
[codeDir, ~] = fileparts(codeFile);
codeDir = [codeDir '/'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment