Hi, I'm writing a simple script to read a .csv file. I get the error:
Undefined function or variable 'fgetl'. Error in (filename) (line 36) line = fgetl(fid);"
It's strange because the call to fgetl() outside the if statement works fine!
if(~exist(file_in)) FInputErrMsg = 'not located in working directory.'; Suggestion = ['Change script parameter or move the file into script'... ' working directory.']; error('Expected input file: "%s" %s\n%s',file_in,FInputErrMsg,Suggestion); elseif(exist(file_out)) % TODO#1
end% Open file_in1 to count the number of sites N
fid = fopen(file_in,'r');line = fgetl(fid);if(fid == -1) error('Error opening %s. Exiting.', file_in); else line = fget1(fid); %<---------------------- Offending Line
endfclose(fid);
Best Answer