Skip to content

Instantly share code, notes, and snippets.

View tsalo's full-sized avatar
🏠
Working from home

Taylor Salo tsalo

🏠
Working from home
View GitHub Profile
@tsalo
tsalo / cleanPath.m
Created March 10, 2015 19:48
Removes extra slashes from path string.
function fixedPath = cleanPath(inPath)
% FORMAT fixedPath = cleanPath(inPath)
% Removes extra slashed from inPath.
[filePath, fileName, fileSuffix] = fileparts(inPath);
if isempty(fileSuffix)
splitFile = regexp(filePath, '/', 'split');
else
splitFile = regexp(inPath, '/', 'split');
@tsalo
tsalo / getCodeDir.m
Last active August 29, 2015 14:16
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 '/'];