MATLAB: Parse error when using importfile

importimportfile

I'm trying to import data from a .csv file (either one) into a matrix. I'm getting a "parse error" at line 1:
function waxsexposures = waxsimport('waxs_exposures_2015', 1, inf)
This is of the form
waxsexposures = importfile('waxs_exposures.par', startRow, endRow)
I've tried the following:
waxsexposures = waximport('waxs_exposures_2015')
—return—>Not enough input arguments.
waxsexposures = waximport('waxs_exposures_2015.par')
—return—>Unexpected MATLAB operator.
function waxsexposures = waxsimport(waxs_exposures_2015, startRow, endRow)
%%Initialize variables.
delimiter = ' ';
if nargin<=2
startRow = 1;
endRow = inf;
end

Best Answer

Leave off the "function" when you invoke. You should use the code like you have at the bottom but to test it you should be using
waxsexposures = waxsimport('waxs_exposures_2015', 1, inf)
at the command line, without the word "function".