Subscript indices must either be real positive integers or logicals.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Subscript indices must either be real positive integers or logicals.
Error in ==> Vinci_DLR at 175 alpha_amb = alpha(Nu_amb, la_amb, do, 1);
My alpha-calculation is a very simple function within my m-file and works without error in a single run. For iterative approach I nested it in a while-loop and I got the error above at second iteration. Why? I have similar other functions in this while loop where this problem does not occur.
Examples:
Ra = Raleigh(dT_amb, L, amb_type); % Raleighnr. for ambient convection
Nu_amb = Nusselt(0, Pr_amb, Ra, 0, 0, 2) % Nusselt number
0 Kommentare
Akzeptierte Antwort
Adam
am 28 Okt. 2014
Bearbeitet: Adam
am 28 Okt. 2014
I assume alpha is meant to be a function?
Are you also naming a variable alpha within the same workspace? If so then that variable will take precedence and the line you quote will be interpreted as trying to index into the variable rather than pass arguments to the function.
On a similar note, 'alpha' is actually also the name of a builtin Matlab function. It may not be one you require to use within your code, but it is good practice generally to avoid stamping on names of builtin functions unless you actually want to over-ride them.
You can type
which alpha
or
which alpha -all
to find out if a name already exists as function or as a variable too.
0 Kommentare
Weitere Antworten (2)
yonatan gerufi
am 28 Okt. 2014
your example is very hard to understand.
you should use debug to catch the error.
try this method:
try
your code..
catch
display('error') - put break point here!
end
now, when it stops see the value of indices.
good luck!
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!