MATLAB: Full File Path Quotation Marks (Double vs Single)

ioloadpython

A small thing that I often work around is changing file path names enclosed in double quotes to single quotes to load them into MATLAB.
In Windows I like to get a full file path (for some file that is not in my current MATLAB directory, or on PATH) with right-click + Copy As Path, which dumps a string like this on the clipboard: "C:\Users\Peter\Desktop\Pinnacle\Folder1\Folder2\Folder3\allMinima645.mat" which I need to change to this form to use the load function in MATLAB: 'C:\Users\Peter\Desktop\Pinnacle\Folder1\Folder2\Folder3\allMinima645.mat'
In python (which has its own preferred directory/path format) I can load the same using the "r" flag to tell it that I'm working with regular text formatting:
import scipy.io as sio
sio.loadmat(r"C:\Users\Peter\Desktop\Folder1\Folder2\Folder3\allMinima645.mat")
which I find slightly less cumbersome than this:
load(regexprep('"C:\Users\Peter\Desktop\Folder1\Folder2\Folder3\allMinima645.mat"','"',''))
Is there a MATLAB equivalent of pythons "r" flag (or another way to work with this)?

Best Answer

You could create your own function to remove the double quotes.
function S = Unquoted(S)
if length(S) >= 2
if S(1) == '"'
S(1) = [];
end
if S(end) = '"'
S(end) = [];
end
end