Subscript indices must either be real positive integers or logicals.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Martin
el 28 de Oct. de 2014
Respondida: Martin
el 28 de Oct. de 2014
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 comentarios
Respuesta aceptada
Adam
el 28 de Oct. de 2014
Editada: Adam
el 28 de Oct. de 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 comentarios
Más respuestas (2)
yonatan gerufi
el 28 de Oct. de 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!
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!