Index exceeds matrix dimensions
이전 댓글 표시
HI.
I've encouter an issue with Matlab.
I've a function which have for purpose to find in a dir take in input of the function the most recent dir/file in it and put the path of this dir/file in output.
I must run it with a 2015 MCR (Matlab compiler runtime) i've no problemes when i run it on Matlab 2020.
But when i try to run it with my 2015x Matlab version this msg came :
Index exceeds matrix dimensions (line where is the condition if)
Error in table/dotParentReference (l82)
Here is my code :

How can the index exceeds the matrix dimensions ?
Indeed i search dossier_a__chercher.datenum as many times i have dir/file in my current dir.
Nota : dossier_a_chercher_.datenum is a collumn. Do someone know if in the 2015 Matlab version we were able to acced at an element of a column like an element of a list as we can do with the current version ?
Sry for my english i hope this issue will be understandable
It would be very nice if someone has something to try !
Thx
댓글 수: 5
Jorg Woehl
2021년 3월 10일
Hi Tom, that's indeed strange... I would suggest checking the following:
- What's the value returned for nombre_dossier inside the function (line 2)? Just to make sure that it's not 0 and indeed corresponds to the number of files/folders in dossier.
- What is the value for i when the error occurs? You can use the debugger, or simply add a line i (without semicolon) before the if statement.
the cyclist
2021년 3월 10일
This does seem weird. You might also just check
length(dossier_a_chercher.name)
length(dossier_a_chercher.datenum)
to see if they give the same value ahead of the loop. I can't think of a circumstance in which they would give different values, but it might give a hint.
Tom Argentin
2021년 3월 10일
Walter Roberson
2021년 3월 11일
Was there a good reason to convert to a table instead of leaving it as a struct? It just means that you move the (i) indexing to the structure name instead of after the field name, and that you take length of the structure instead of length of the name field.
Tom Argentin
2021년 3월 11일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!