I am installing WFDB Toolbox for Matlab 2016a in Ubuntu Linux 14.04 64bit, which instructions are here. I do [old_path]=which('rdsamp');if(~isempty(old_path)) rmpath(old_path(1:end-8)); endwfdb_url='http://physionet.org/physiotools/matlab/wfdb-app-matlab/wfdb-app-toolbox-0-9-9.zip';[filestr,status] = urlwrite(wfdb_url,'wfdb-app-toolbox-0-9-9.zip');%Octave users may have to download manuallyunzip('wfdb-app-toolbox-0-9-9.zip');cd wfdb-app-toolbox-0-9-9;cd mcodeaddpath(pwd);savepathI get a permission issueWarning: Unable to save path to file '/usr/local/MATLAB/R2016a/toolbox/local/pathdef.m'. Youcan save your path to a different location by calling SAVEPATH with an input argument thatspecifies the full path. For MATLAB to use that path in future sessions, save the path to'pathdef.m' in your MATLAB startup folder. I would like to save to the default location indicated in the error i.e. by per-user pathdef.m file. Results of thrig's answerWorks in the latest update of Ubuntu 16.04 64 bit Does not work in OS X El Capitan. Do in Terminalecho export MATLAB_USE_USERWORK=1 >> $HOME/.bashrcmatlab -nodesktop -nosplash -r \     userpath('/home/masi/Documents/bin/matlab/'); exit;Final setup if (exist('old_path', 'var') == 0)     home='/home/masi/';    [old_path]=which('rdsamp');if(~isempty(old_path)) rmpath(old_path(1:end-8)); end    wfdb_url='http://physionet.org/physiotools/matlab/wfdb-app-matlab/wfdb-app-toolbox-0-9-9.zip';    [filestr,status] = urlwrite(wfdb_url,'wfdb-app-toolbox-0-9-9.zip');%Octave users may have to download manually    unzip('wfdb-app-toolbox-0-9-9.zip');    cd(fullfile(home, 'wfdb-app-toolbox-0-9-9', 'mcode'));    addpath(fullfile(home, 'wfdb-app-toolbox-0-9-9/mcode/')); % me    %addpath(fullfile('wfdb-app-toolbox-0-9-9', 'mcode'));    % Bug command sets userpath to '', why? http://stackoverflow.com/q/38283814/54964    %savepath(fullfile(home, 'pathdef.m')); % ~/pathdef.m originallyendHow can you install WFDB by per-user pathdef.m file in Matlab 2016a?
Why Unable to Install WFDB?
matlab
You could (temporarily) assign write permission to that file for the user, e.g. sudo chown youruseraccount /usr/local/MATLAB/R2016a/toolbox/local/pathdef.m and then do the install, and change the permissions back. But this won't fly if you lack privileges to do so. Another option is to change the savepath call to write a custom pathdef.m:$ cd$ matlab...>> mkdir wfdb>> cd wfdb>> [old_path]=which('rdsamp');if(~isempty(old_path)) rmpath(old_path(1:end-8)); end...>> savepath ~/pathdef.m>> exit...$ matlab...>> wfdbThis assumes that your home directory is your startup folder for matlab, though the pathdef.m could be saved to some other directory and matlab started up from that directory, or the initial folder path changed in the matlab preferences.