フィルターのクリア

Index exceeds matrix dimensions

1 回表示 (過去 30 日間)
Jamil Dudhwala
Jamil Dudhwala 2019 年 2 月 19 日
コメント済み: Adam 2019 年 2 月 19 日
Hi,
I am trying to make a for loop, however the code I am using turns out the error : index exceeds matrix dimensions, I can't quite work out what I am doing wrong.
my code is below:
S1=1.7*1.2
U=1.5
Tout=5
for index=1:1:30
%Ambient Load
Ts=Ts(index-1)
Tin=Tin(index-1)
S1QAmb=S1*U*(Tout-(2*Ts)+Tin) %surface 1, ambient load
end
  3 件のコメント
Jamil Dudhwala
Jamil Dudhwala 2019 年 2 月 19 日
Is this more to do with the fact that I have not intialised it?
Adam
Adam 2019 年 2 月 19 日
If that is lterally all your code then of course it will not work. What are you expecting the result to be of indexing into a variable that does not exist yet?

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

採用された回答

KSSV
KSSV 2019 年 2 月 19 日
A = rand(5,1) ; % an array of size 5*1
A(1) % works
A(5) % works
A(6) % throws error
The above array has only 5 elements....If you try to extract more than 5 elements, it will throw error.

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by