MATLAB: Does ADDPATH not allow me to add a directory with a space in it in MATLAB 7.7 (R2008b)

anddocumentsMATLABsettings

When I try to add a directory with a space in it using the ADDPATH command:
addpath C:\Program Files\
I get the following warning:
Warning: Name is nonexistent or not a directory: C:\Program.
It seems that ADDPATH does not like the space in the directory name.

Best Answer

When using the command syntax of ADDPATH, spaces between string inputs are interpreted as separators between arguments. To ensure that ADDPATH interprets the directory as a single argument, use the function syntax with parenthesis and single quotes around the directory name. For example:
addpath('C:\Program Files')