In my program, I am reading an input text file using the following code:
file = fileread(GAFname);fileText = regexp(file, '\r\n|\r|\n', 'split')';
The text file can be anything, in this case let's use:
ABCDE
The text file is created in windows using notepad++. When executing this code on windows, it splits up file into 5×1 cells perfectly. But when the same files are transferred to a Linux workstation, it suddenly makes a 6×1 cell array with the last one being empty.
Does anyone know if this is related to regexp, creation of the text file (i.e. windows vs linux in terms of \r and \n), or is this caused by something else? Could it be because the version of MATLAB on the Linux workstation is 2018b?
I tried the following: I copied all but the last line into a Linux text editor and then manually entered the last line in the Linux editor then saved. It does not fix the problem so maybe it is not due to windows vs Linux text editors.
Thanks!
Jesse
Best Answer