<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hallo Frieder,<br>
insert the line<br>
<pre style="font-family:Courier New;font-style:normal;font-size:12.0;"><span style="color:rgb(50,185,185);"> disp</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(188,143,143);">################</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);"> c</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(0,0,0);">c</span><span style="color:rgb(0,0,0);">, </span><span style="color:rgb(0,0,0);">sizeA</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(50,185,185);">size</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">A</span><span style="color:rgb(74,85,219);">)
before the problem line
</span> if A(c-1,3)==0 then
and you will see what happens there.
Regards
Jens
-----------------------------------
</pre>
<br>
<div class="moz-cite-prefix">Am 06.10.2016 08:29, schrieb Frieder
Nikolaisen:<br>
</div>
<blockquote
cite="mid:a01bb508dae346c46271caa4b6af8cee@mail.student.hs-rm.de"
type="cite">With the real Code, it's more difficult to predict the
first c.
<br>
<br>
Thats why I do use
<br>
<blockquote type="cite">//start of buggy code
<br>
if c>=2 then...
<br>
</blockquote>
to make sure, that c=1 cant Trouble the following code.
<br>
<br>
<br>
Am 06.10.2016 08:21, schrieb Carrico, Paul:
<br>
<blockquote type="cite">Without launching the code, I would say :
<br>
C = 1 : 30
<br>
And
<br>
A(c-1,3)
<br>
<br>
If c = 1 then A(0,3) that is not possible since the index start
to 1 ... no ?
<br>
<br>
<br>
-----Message d'origine-----
<br>
De : users [<a class="moz-txt-link-freetext" href="mailto:users-bounces@lists.scilab.org">mailto:users-bounces@lists.scilab.org</a>] De la part de
<br>
Frieder Nikolaisen Envoyé : jeudi 6 octobre 2016 08:18 À : Users
<br>
mailing list for Scilab Objet : [EXTERNAL] [Scilab-users]
!--error 21
<br>
<br>
Hello everybody,
<br>
<br>
I do have a code, I cannot find the mistake. I get the error:
<br>
<br>
" if A(c-1,3)==0 then
<br>
!--error 21
<br>
ungültiger Index.
<br>
at line 11 of exec file called by :
<br>
exec('M:\CAD\Abteilungen\Praktikanten\Nikolaisen,
<br>
Frieder\Fahrdaten\Testprogramm\Archive\test2.sce', -1)"
<br>
<br>
My minimal example Code with random Matrix instead of the real
used
<br>
one:
<br>
<br>
//example code
<br>
<br>
for c=1:10
<br>
A=rand(10:30)
<br>
dm=0
<br>
vor_starter=0
<br>
starter=0
<br>
<br>
//start of buggy code
<br>
if c>=2 then
<br>
if A(c-1,3)==0 then
<br>
if A(c,7)>0 then
<br>
beginnZ=c
<br>
vor_starter=1 /
<br>
end
<br>
end
<br>
//Endzeile festlegen
<br>
if vor_starter==1 then
<br>
if A(c-1,7)>0 then /
<br>
if A(c,7)<=0 then
<br>
endZ=c-1
<br>
starter=1
<br>
vor_starter=0
<br>
end
<br>
end
<br>
end
<br>
<br>
//Berechnung der Zugmasse
<br>
if starter==1 then
<br>
time3=datevec(A(beginnZ,1))
<br>
time4=datevec(A(endZ,1))
<br>
delta_t=etime(time3, time4)
<br>
delta_v=(A(endZ,3)-A(beginnZ,3)*3.6) // m/s
<br>
length_F=length(beginnZ:endZ)
<br>
mittel_F=sum(A(beginnz:endZ,6)/length_F)
<br>
dm= (delta_t/delta_v) / mittel_F
<br>
starter=0
<br>
end
<br>
end
<br>
<br>
if dm~=0 then
<br>
disp(dm)
<br>
end
<br>
<br>
// end of buggy code
<br>
<br>
end
<br>
<br>
<br>
<br>
The real Matrix Looks like These:
<br>
Zeit Distanz Geschwindigkeit 1 Drehzahl
Getriebeausgangsleistung
<br>
[Watt] Zugkraft [N] Beschleunigung [m/s^2] Cv-Druck
Richtung Lokbremse
<br>
anlegen Lokbremse lösen Zugbremse anlegen Zugbremse
lösen Kupplung
<br>
betätigt Bremsen aktiv
<br>
734962.404654 46476.494 0.00 1150.71 141700 0
0.00 0 0 0 0 1 0 0
<br>
734962.404900 46476.494 0.00 1059.06 110500 0
0.00 0 0 1 0 1 0 0
<br>
734962.404902 46476.494 0.00 1059.06 110500 0
0.00 0 0 1 1 1 1 0
<br>
734962.404971 46476.495 1.70 1059.06 110500
234000 1.04 0 0 1 1 1 1 0
<br>
...
<br>
<br>
<br>
Best regards
<br>
Frieder
<br>
_______________________________________________
<br>
users mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<br>
<br>
<a class="moz-txt-link-freetext" href="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=">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=</a>
<br>
<br>
<br>
EXPORT CONTROL :
<br>
Cet email ne contient pas de données techniques
<br>
This email does not contain technical data
<br>
_______________________________________________
<br>
users mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<br>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
<br>
</blockquote>
<br>
_______________________________________________
<br>
users mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<br>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
<br>
</blockquote>
<br>
</body>
</html>