[Scilab-users] [EXTERNAL] !--error 21

Carrico, Paul paul.carrico at esterline.com
Thu Oct 6 08:21:04 CEST 2016


Without launching the code, I would say :
C = 1 : 30
And
A(c-1,3)

If c = 1 then A(0,3) that is not possible since the index start to 1 ... no ?


-----Message d'origine-----
De : users [mailto:users-bounces at lists.scilab.org] De la part de Frieder Nikolaisen Envoyé : jeudi 6 octobre 2016 08:18 À : Users mailing list for Scilab Objet : [EXTERNAL] [Scilab-users] !--error 21

Hello everybody,

I do have a code, I cannot find the mistake. I get the error:

"    if A(c-1,3)==0 then
                 !--error 21
ungültiger Index.
at line      11 of exec file called by :
exec('M:\CAD\Abteilungen\Praktikanten\Nikolaisen,
Frieder\Fahrdaten\Testprogramm\Archive\test2.sce', -1)"

My minimal example Code with random Matrix instead of the real used
one:

//example code

for c=1:10
A=rand(10:30)
dm=0
vor_starter=0
starter=0

//start of buggy code
if c>=2 then
     if A(c-1,3)==0 then
         if A(c,7)>0 then
             beginnZ=c
             vor_starter=1   /
         end
     end
         //Endzeile festlegen
     if vor_starter==1 then
         if A(c-1,7)>0 then      /
             if A(c,7)<=0 then
                 endZ=c-1
                 starter=1
                 vor_starter=0
             end
         end
     end

     //Berechnung der Zugmasse
     if starter==1 then
         time3=datevec(A(beginnZ,1))
         time4=datevec(A(endZ,1))
         delta_t=etime(time3, time4)
         delta_v=(A(endZ,3)-A(beginnZ,3)*3.6)     // m/s
         length_F=length(beginnZ:endZ)
         mittel_F=sum(A(beginnz:endZ,6)/length_F)
         dm= (delta_t/delta_v) / mittel_F
         starter=0
     end
end

if dm~=0 then
     disp(dm)
end

// end of buggy code

end



The real Matrix Looks like These:
Zeit	Distanz	Geschwindigkeit 1	Drehzahl	Getriebeausgangsleistung 
[Watt]	Zugkraft [N]	Beschleunigung [m/s^2]	Cv-Druck	Richtung		Lokbremse 
anlegen	Lokbremse lösen	Zugbremse anlegen	Zugbremse lösen	Kupplung 
betätigt	Bremsen  aktiv
734962.404654	46476.494	0.00	1150.71	141700	0	0.00	0	0	0	0	1	0	0
734962.404900	46476.494	0.00	1059.06	110500	0	0.00	0	0	1	0	1	0	0
734962.404902	46476.494	0.00	1059.06	110500	0	0.00	0	0	1	1	1	1	0
734962.404971	46476.495	1.70	1059.06	110500	234000	1.04	0	0	1	1	1	1	0
...


Best regards
Frieder
_______________________________________________
users mailing list
users at lists.scilab.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.scilab.org_mailman_listinfo_users&d=DQIGaQ&c=0hKVUfnuoBozYN8UvxPA-w&r=4TCz--8bXfJhZZvIxJAemAJyz7Vfx78XvgYu3LN7eLo&m=nlCd0TGhAve5QECL-uPD6MaElfbx9CXO4IosetysN-0&s=zqTXVWWgu1x-XetICW1PCKDY9fcNeZZPL0ByDWVhwdo&e= 

EXPORT CONTROL : 
Cet email ne contient pas de données techniques
This email does not contain technical data


More information about the users mailing list