Row index exceeds table dimensions

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

Kevin Holly
Kevin Holly 2022년 8월 5일
What is Tnew?
David
David 2022년 8월 5일
A table where the data from the test series are summarized.
But I think that I have solved the problem. There are 7 cycles of 160 values each and the table was only 1117 values long, so it came to the error. I changed the table to 1120 values, so that the values are all in the new table.
Btw: I now have this table where each cycle is a column in the new table. Now I need the maximum value of each column, which I then want to plot in a chart.
But i got this error: Error using max
Invalid data type. First argument must be numeric or logical.
Isnt the data in this table numeric?
You can type
class(Tnew.Var1)
Then we can see if the values are numeric or if they are cells.
Les Beckham
Les Beckham 2022년 8월 5일
Suggestion:
Don't name a variable max since that is a built-in Matlab function (especially if you are actually trying to use the max function).
David
David 2022년 8월 5일
Same error as before..
I need the max values from the table i send you before (T_Umlenkung).
Walter Roberson
Walter Roberson 2022년 8월 5일
you cannot apply max() to a table()
You can use varfun() to apply max to each column

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

답변 (1개)

Chetan
Chetan 2023년 9월 1일

0 개 추천

Hi @David!
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:
Hope it helps !

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2022년 8월 5일

답변:

2023년 9월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by