I don't have the MATLAB file and copying and pasting produced errors which I'm sure are different than yours. I don't have the data file, though I guess I could create it from the data you supplied. And I don't have the error - you forgot to tell us. So all of that leads me to suggest you solve it yourself with the debugger. It will actually be the fastest way to solve it rather than debugging via messages to the Answers forum.