필터 지우기
필터 지우기

Index exceeds matrix dimensions.

조회 수: 1 (최근 30일)
elisa ewin
elisa ewin 2017년 3월 22일
편집: Adam 2017년 3월 22일
Hi! I have to implement a formule vp(i)=lambda*v(i)+(1-lambda)*vp(i-1)
I have used this code
for i=1:size(Users,2)
for j=1:size(Users(i).data_split3,1)
if (userTouristicTraj(i).touristicData(j).time_in_secs ~= 0)
for l=1:size(userTouristicTraj(i).touristicData(j).time,1)
userTouristicTraj(i).touristicData(j).average_speed(l)=userTouristicTraj(i).touristicData(j).travel_speed(l);
userTouristicTraj(i).touristicData(j).average_speed(l+1)=lambda*userTouristicTraj(i).touristicData(j).travel_speed(l+1)+(1-lambda)*userTouristicTraj(i).touristicData(j).average_speed(l);
end
end
end
end
it doesn't run, can you give me some suggestions to solve the problem? thanks
  댓글 수: 2
KSSV
KSSV 2017년 3월 22일
No information about variables used and the attached mat file. Tough to get help unless you explain the question.
Adam
Adam 2017년 3월 22일
편집: Adam 2017년 3월 22일
doc dbstop
Specifically:
dbstop if error
although I always use the dropdown list in the editor ribbon. These kinds of errors are trivial to find and understand if you just use the debugger and the option for it to stop when it hits an error so that you can examine the code.

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2017년 3월 22일
편집: Jan 2017년 3월 22일
I boldy guess, that
userTouristicTraj(i).touristicData(j).travel_speed
does not have
size(userTouristicTraj(i).touristicData(j).time,1) + 1
elements. Then the indexing by (l+1) must fail.
I cannot run your code due to the m,issing variable "Users".

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Debugging and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by