Index exceeds matrix dimensions
Mostra commenti meno recenti
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 Commenti
Adam
il 19 Feb 2019
Ts is not defined anywhere.
If it where then I would expect the first error you get would be that indices must be real positive values since
index-1
will clearly be 0 on the first time round the loop, which is not a valid index into an array.
Jamil Dudhwala
il 19 Feb 2019
Adam
il 19 Feb 2019
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?
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Matrix Indexing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!