I think you should check whether the file is opened correctly. The error message seems to indicate that this is not the case. If it is not, check if the filepath
is correct.
fid = fopen (filepath, 'rt');
if fid == -1
error('Failed to open file');
end
If the error is thrown here, you know that there was a problem with 'fopen'
.
Ofcourse I don't know which files are on your computer, but I assume the '...'
in the filename is not in your actual matlab file, only in your question on SO.
But could it be that you repeat the word 'data'
, while the actual filename only contains 'data'
once? You code now will result in filenames like ''C:\Users\...\datadata_1_output.csv'
. Maybe 'data'
should be removed in data_directory
or in filepath = ...
?