Index exceeds the number of array elements (1).

1 回表示 (過去 30 日間)
Student
Student 2021 年 9 月 26 日
編集済み: Student 2021 年 9 月 26 日
Hello. I do know how to solve this error message:
Index exceeds the number of array elements (1).
B1=(abs_rock*Q_north(Hour)*A_nw+h_o*A_nw*T_o(Hour))
My matrix_A works but I have an issue with Matrix_b which originates from the values I input.
How do I fix it so I can move on?
  3 件のコメント
Student
Student 2021 年 9 月 26 日
This is the code
i want the values for each hour and then use the results to create graph for each surface for every hour.
Thank you for answering.
Image Analyst
Image Analyst 2021 年 9 月 26 日
編集済み: Image Analyst 2021 年 9 月 26 日
No that was not all the code. Here's proof. I just copied, pasted, and ran your code in a new editor script called test.m and this is what I got:
>> test
Unrecognized function or variable 'abs_rock'.
Error in test (line 3)
B1=(abs_rock*Q_north(Hour)*A_nw+h_o*A_nw*T_o(Hour))
Why do you think it should know what abs_rock is? It doesn't.
But it looks like Cyclist got your code to work even without all of it, so that's good. In the future though, attach all your code or attach your data and code to read in the data from a file. You'll get an answer much sooner. Anyway, thanks for Accepting his answer to award him reputation points.

サインインしてコメントする。

採用された回答

the cyclist
the cyclist 2021 年 9 月 26 日
When you make this assignment:
T_o=10+15.*sin((Hour-9).*(pi/12));
it looks like T_o is a scalar (i.e. length 1), but then you do
T_o(Hour)
which will give you the error you saw, when Hour == 2. Maybe you intended
T_o(Hour)=10+15.*sin((Hour-9).*(pi/12));
  1 件のコメント
Student
Student 2021 年 9 月 26 日
Thank you so much!

サインインしてコメントする。

その他の回答 (1 件)

Student
Student 2021 年 9 月 26 日
You are right i should have attached the whole question. I am a bit new at this i do really appreciate your help as well. Maybe you can help me with my next question please?

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by