MATLAB: Undefined function ‘[name function]’ for input arguments of type ‘double’. for vector

error

Hi,
To do some calculations on sprint data I wrote a simple script, underneath is a part of it. It runs fine till the calculation of the T1SprintBestMomentum10m. Some how I get the ERROR
"Undefined function 'T1SprintBestSplit10m' for input arguments of type 'double'."
and I have no idea how to fix it, because there is no difference between the first for loop and the second one and it works fine for the T1SprintBestMomentum5m. All files are in the same directory and the T1SprintBest10m is not a function… Could someone help me with this problem? (I already tried to close matlab and to shutdown my laptop and start it again, it doesn't work)
——————————–
% Calculate Velocities of Best Sprint in m/s SprintDistanceRun=30; T1SprintBestVelocity5m(1:length(T1SprintBestTime),1)= zeros; T1SprintBestVelocity10m(1:length(T1SprintBestTime),1)= zeros; T1SprintBestVelocity20m(1:length(T1SprintBestTime),1)= zeros; T1SprintBestVelocity30m(1:length(T1SprintBestTime),1)= zeros;
for i=1:length(T1SprintBestTime)
T1SprintBestVelocity5m(i,1)= SprintDistanceRun/T1SprintBestSplit5m(i);
T1SprintBestVelocity10m(i,1)= SprintDistanceRun/T1SPrintBestSplit10m(i);
T1SprintBestVelocity20m(i,1)= SprintDistanceRun/T1SPrintBestSplit20m(i);
T1SprintBestVelocity30m(i,1)= SprintDistanceRun/T1SprintBestTime(i);
end
%Calculate Momentums of Best Sprint in Ns T1BodyMass=SprintData(:,2);
T1SprintBestMomentum5m(1:length(T1SprintBestTime),1)= zeros; T1SprintBestMomentum10m(1:length(T1SprintBestTime),1)= zeros; T1SprintBestMomentum20m(1:length(T1SprintBestTime),1)= zeros; T1SprintBestMomentum30m(1:length(T1SprintBestTime),1)= zeros;
for i=1:length(T1SprintBestTime)
T1SprintBestMomentum5m(i,1)= T1SprintBestSplit5m(i,1)*T1BodyMass(i);
T1SprintBestMomentum10m(i,1)= T1SprintBestSplit10m(i,1)*T1BodyMass(i);
T1SprintBestMomentum20m(i,1)= T1SprintBestSplit20m(i,1)*T1BodyMass(i);
T1SprintBestMomentum30m(i,1)= T1SprintBestTime(i,1)*T1BodyMass(i);
end

Best Answer

Dear Laura,
MATLAB thinks that he needs the function 'T1SprintBestSplit10m'. This is because you wrote down 'T1SPrintBestSplit10m(i)'.
The problem may arise because in some lines you use T1SprintBestSplitXX with a capital S and capital P, and in some lines you use capital S and 'normal' p.
If this is not the case, I would suggest that you debug your program, and check when the problem arises. If you have found the problem, stop the program at that place and do the following:
  1. write in the MATLAB prompt: 'who T1SprintBestSplit10m'
  2. look in the workspace for a variable named 'T1SprintBestSplit10m'
If a function T1SprintBestSplit10m is present, look where it should be. If no variable 'T1SprintBestSplit10m' is present, then the calculation of T1SprintBestSplit10m is wrong.
Good luck! Christiaan