Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Index exceeds matrix dimensions. Error in LT_03 (line 98)

1 Ansicht (letzte 30 Tage)
Jakob J
Jakob J am 22 Okt. 2020
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
Hi. I created a program that averaged hourly weather data over 15 years. When trying to start a calculation, MATLAB gives the following error:
Index exceeds matrix dimensions.
Error in LT_03 (line 98)
Fk(i)=(f01(i)+f02(i)+f03(i)+f04(i)+f05(i)+f06(i)+f07(i)+f08(i)+f09(i)+f10(i)+f11(i)+f12(i)+f13(i)+f14(i)+f15(i))/15;
I added links to the corresponding files to the directory. What is the problem, please tell me.
  2 Kommentare
KSSV
KSSV am 22 Okt. 2020
The error is clear......check the value of i loop index. This will be greater than the number of elements present in your arrays i.e f01, f02,...etc...
Jakob J
Jakob J am 22 Okt. 2020
I got the idea. The problem is that using an array of data for another month for a 15 year period, the program works, builds a graph, and the average value is calculated. When I change the names in the array directories, I end up with a similar error, which I indicated in the topic of this forum section.

Antworten (1)

KSSV
KSSV am 22 Okt. 2020
Note that for your formula given you need not to use loop...you can striaght away use:
Fk =(f01+f02+f03+f04+f05+f06+f07+f08+f09+f10+f11+f12+f13+f14+f15)/15;

Produkte


Version

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by