Info

This question is closed. Reopen it to edit or answer.

Getting the error "Subscript indices must either be real positive integers or logicals" when it is a postive integer

1 view (last 30 days)
I continue to throw an error "Subscript indices must either be real positive integers or logicals". If I am to replace the variable "IC_Time_SagitalAnkleKinematics" with the value that it stands for (which is a frame number, so always a whole number) the code works fine. Any ideas why this would be happeneing?
Appreciate the help
CB
for i=1:n
IC_Time_SagitalAnkleKinematics((1:1),i)=IC(i,1)*200;
FC_Time_SagitalAnkleKinematics((1:1),i)=FC(i,1)*200;
IC_SagitalAnkleKinematics(1,i)=SagitalAnkleKinematics(IC_Time_SagitalAnkleKinematics,i);
FC_SagitalAnkleKinematics(1,i)=SagitalAnkleKinematics(FC_Time_SagitalAnkleKinematics,i);
end

Answers (1)

the cyclist
the cyclist on 17 Sep 2015
Are you certain the value of that variable is exactly a whole number, and not something like
3.0000000000001
?
To debug this, you could
  • put a breakpoint at the spot in the code where the error occurs (or use "dbstop if error")
  • set the command window display format to show more precision (e.g. "format long")
  • see what that variable looks like

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!