MATLAB: Does the LOAD command return a variable starting with an underscore ( _ ) when I specify a full or partial path to an ASCII data file

asciiloadMATLABpartialpathtext;underscore

I have a text file called data.txt that has the following data in it:
1 2 3 4 5 6 7 8 9 10
This file is in a subdirectory of my current working directory. When I load the file, I use one of the following commands:
load ./datafiles/data.txt
% or
load C:\MATLAB6p5\work\datafiles\data.txt
MATLAB loads the data into the workspace and calls it _datafiles_data or _MATLAB6p5_work_datafiles_data respectively. I am not able to use the data because MATLAB variables cannot begin with an underscore.

Best Answer

This has been verified as a bug in MATLAB in the way that the LOAD command handles loading text files into the MATLAB workspace. As a workaround, you can use the functional form of load and specify the variable name. For example:
data = load('./datafiles/data.txt')
% or
data = load('C:\MATLAB6p5\work\datafiles\data.txt')
Alternatively, you can also use a partial path and use the backslash as a file separator instead of the forward slash:
load .\datafiles\data.txt