Row index exceeds table dimensions
조회 수: 6 (최근 30일)
이전 댓글 표시
Hi Guys, i got the following error in my script:
Error using ()
Row index exceeds table dimensions.
in (line 51): T_Umlenkung(m,j)=Tnew(h,"Umlenkung");
h=1;
T_Umlenkung = array2table(zeros(Werte_pro_Zyklus,Zyklen));
for j=1:1:Zyklen
for m=1:1:160
T_Umlenkung(m,j)=Tnew(h,"Umlenkung");
h=h+1;
end
end
max = max(T_Umlenkung);
The goal is to retrieve data from a table (length 1117) and create a new table that has 160 values in each column (160 values = 1 cycle). Afterwards, the maximum value of each cycle is to be recorded and plotted in a diagram.
Why does the code give the error mentioned above?
댓글 수: 6
Walter Roberson
2022년 8월 5일
you cannot apply max() to a table()
You can use varfun() to apply max to each column
답변 (1개)
Chetan
2023년 9월 1일
Based on my understanding, it seems that you are encountering difficulties with indexing a table. This issue arises due to a size incompatibility. When importing a table, MATLAB ignores the first row, so the size of the table should be 1 less than the total number of rows you are referring to.
Additionally, if you need to calculate the maximum value on the table, you cannot do it directly. Instead, you can use the “varfun” functionality or calculate it column-wise.
For more details and solutions, I recommend referring to the following links:
- How to solve the error 'Row index exceeds table dimensions' - MATLAB Answers - MATLAB Central (mathworks.com)
- How to get average/max/min table of many tables - Help Center - MATLAB & Simulink (mathworks.com)
- Apply function to table or timetable variables - MATLAB varfun - MathWorks India
Hope it helps !
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!