Looks to me like it should be okay. Try putting parentheses around "end-1" and "end-10079" and see if that fixes it. If it doesn't then set
lastTimeIndex = length(TIME);
lastValIndex = size(VAL, 2);
and then use lastTimeIndex and lastValIndex instead of end and see if that works.
Do you want parentheses around "VAL(10,end)-60/86400" or not. That's another thing to check.
Best Answer