I've downloaded brtyrpre.txt from your comments and copy&pasted brtyr_error_pre.txt from your question ("Here is the one the script crashed"). Next I run the script of your comment. brtyr_error_pre.txt was processed without problems and the script throw an the error for the first row of brtyrpre.txt.
>> Untitled
Processing file: brtyr_error_pre.txt
Processing file: brtyrpre.txt
Error using fprintf
Function is not defined for 'cell' inputs.
Error in Untitled (line 34)
fprintf( fid, '%6.0f, %7.4f \n ' , Vdata );
K>>
The the text of the error differs somewhat, but the message is the same. I run R2018b.
The reason for the error is that in one of the files there are letters among the numerical data (as Walter assumed). With letters among the numerical data the entire column is imported as character, without letters it's imported as double. When "extracting" a character column from a table you get a cell array, which causes the error.
"The script runs through the first two text files with no issues then crashes on the first line of the next text file." Run one file at a time to become 101% sure which file causes the error.
K>> workfile(1:3,:)
ans =
3×3 table
Var1 Var2 Var3
__________ ____ ____
10/31/2018 0 0
11/01/2018 0.1 0.1
11/02/2018 0.45 0.45
K>> workfile(1:3,:)
ans =
3×3 table
Var1 Var2 Var3
__________ ______ ______
10/31/2018 '0' '0'
11/01/2018 '0.1' '0.1'
11/02/2018 '0.45' '0.45'
And see
Best Answer