[Scilab-users] {EXT} Re: error 21,Invalid index

Dang Ngoc Chan, Christophe Christophe.Dang at sidel.com
Mon Mar 20 11:11:39 CET 2017


Hello

> De : users [mailto:users-bounces at lists.scilab.org] De la part de abdul rashid
> Envoyé : lundi 20 mars 2017 09:02
>
> !--error 21
> Invalid index.
> at line       8 of function FF_aleas_bis called by :  [...]
>
> Sorry, the mentioned functions file entitled ( fonctions_dynam.sci ) has been forgotten to enclose and now is attached.

Reading the  fonctions_dynam.sci file,
it seems that you use global variables inside functions.

While it is legitimate in some cases,
my opinion is that it should be avoided (i.e. use only local variables)
and in the present case, it is obfuscating:

the line #8 of the FF_aleas_bis is

Stom_p=p(N_species_14+size_q+2:1+size_q+N_species_14+N_species_14^2);

but to know what N_species_14 and size_q are, we have to read the entire code of the project
which is not convenient.

Nevertheless, you should check whether
N_species_14+size_q+2 <= size(p) <= 1+size_q+N_species_14+N_species_14^2
or not.

Hope this helps,

regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


More information about the users mailing list