<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
Hallo Tim,<br>
I have answered my last question by 'while' instead of 'for':<br>
<pre style="font-family:Monospaced;font-style:normal;font-size:12.0;"><span style="color:rgb(176,24,19);">function</span> <span style="color:rgb(131,67,16);font-weight:bold;">k</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(0,0,0);text-decoration:underline;">stopgoclick</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">k</span><span style="color:rgb(0,0,0);">, </span><span style="color:rgb(131,67,16);font-weight:bold;">n</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(100,174,100);font-style:italic;">//control a figure loop by mouseclicks</span>
<span style="color:rgb(100,174,100);font-style:italic;">//INPUT</span>
<span style="color:rgb(100,174,100);font-style:italic;">//k: figure loop counter</span>
<span style="color:rgb(100,174,100);font-style:italic;">//n: length of figure loop</span>
<span style="color:rgb(100,174,100);font-style:italic;">//left mouse click: continue loop i. e. next figure (b(1)=3)</span>
<span style="color:rgb(100,174,100);font-style:italic;">//middle mouse click: abort script (b(1)=4)</span>
<span style="color:rgb(100,174,100);font-style:italic;">//right mouse click: break loop (b(1)=5)</span>
<span style="color:rgb(100,174,100);font-style:italic;">//OUTPUT</span>
<span style="color:rgb(100,174,100);font-style:italic;">//k; n after right mouse click to break loop, else: k from input</span>
<span style="color:rgb(100,174,100);font-style:italic;">//Example: i=1; while i</span><span style="color:rgb(100,174,100);font-style:italic;"><</span><span style="color:rgb(100,174,100);font-style:italic;">=n; plot(x,i*x); i=stopgoclick(i,n); i=i+1; end</span>
<span style="color:rgb(0,0,0);">b</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(50,185,185);">xclick</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(160,32,240);">if</span> <span style="color:rgb(0,0,0);">b</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">==</span><span style="color:rgb(188,143,143);">3</span><span style="color:rgb(100,174,100);font-style:italic;">//left mouse: next image </span>
<span style="color:rgb(95,158,160);">return</span>
<span style="color:rgb(160,32,240);">elseif</span> <span style="color:rgb(0,0,0);">b</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">==</span><span style="color:rgb(188,143,143);">4</span><span style="color:rgb(100,174,100);font-style:italic;">//middle mouse: end script</span>
<span style="color:rgb(95,158,160);">abort</span>
<span style="color:rgb(160,32,240);">elseif</span> <span style="color:rgb(0,0,0);">b</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">==</span><span style="color:rgb(188,143,143);">5</span><span style="color:rgb(100,174,100);font-style:italic;">//break loop</span>
<span style="color:rgb(131,67,16);font-weight:bold;">k</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(131,67,16);font-weight:bold;">n</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">1</span>
<span style="color:rgb(160,32,240);">end</span>
<span style="color:rgb(176,24,19);">endfunction</span>
<span style="color:rgb(0,0,0);">x</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(188,143,143);">0</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">n</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(188,143,143);">10</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">i</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(160,32,240);">while</span> <span style="color:rgb(0,0,0);">i</span><span style="color:rgb(92,92,92);"><=</span><span style="color:rgb(0,0,0);">n</span>
<span style="color:rgb(174,92,176);text-decoration:underline;">plot</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">x</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">i</span><span style="color:rgb(92,92,92);">*</span><span style="color:rgb(0,0,0);">x</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(0,0,0);">i</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(0,0,0);text-decoration:underline;">stopgoclick</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">i</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">n</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">i</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(0,0,0);">i</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(160,32,240);">end</span>
<span style="color:rgb(188,143,143);">'</span><span style="color:rgb(188,143,143);">further commands</span><span style="color:rgb(188,143,143);">'
</span></pre>
I am satisfied with the function. Please advise if a simpler
solution exists.<br>
Cheers<br>
Jens<br>
-------------------------------------------------------------<br>
<div class="moz-cite-prefix">Am 22.11.2016 12:28, schrieb Jens Simon
Strom:<br>
</div>
<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' cite="mid:58342BE9.7030708@hslmg.de" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
Hallo Tim,<br>
Did you mean something like this?:<br>
<pre style="font-style: normal; font-size: 12px;"><font face="Helvetica, Arial, sans-serif"><span style="color:rgb(176,24,19);">function</span> <span style="color:rgb(131,67,16);font-weight:bold;">b1</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(0,0,0);text-decoration:underline;">stopgoclick</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(100,174,100);font-style:italic;">//left mouse: next image,, middle mous: abort</span>
<span style="color:rgb(0,0,0);">b</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(50,185,185);">xclick</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(131,67,16);font-weight:bold;">b1</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(0,0,0);">b</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(160,32,240);">if</span> <span style="color:rgb(131,67,16);font-weight:bold;">b1</span><span style="color:rgb(92,92,92);">==</span><span style="color:rgb(188,143,143);">3</span><span style="color:rgb(100,174,100);font-style:italic;">//left mouse: next image </span>
<span style="color:rgb(95,158,160);">return</span>
<span style="color:rgb(160,32,240);">elseif</span> <span style="color:rgb(131,67,16);font-weight:bold;">b1</span><span style="color:rgb(92,92,92);">==</span><span style="color:rgb(188,143,143);">4</span><span style="color:rgb(100,174,100);font-style:italic;">//middle mouse: end script</span>
<span style="color:rgb(95,158,160);">abort</span>
<span style="color:rgb(160,32,240);">end</span>
<span style="color:rgb(176,24,19);">endfunction</span>
<span style="color:rgb(0,0,0);">x</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(188,143,143);">0</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(188,143,143);">1</span>
<span style="color:rgb(160,32,240);">for</span> <span style="color:rgb(0,0,0);">i</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(188,143,143);">10</span>
<span style="color:rgb(174,92,176);text-decoration:underline;">plot</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">x</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">i</span><span style="color:rgb(92,92,92);">*</span><span style="color:rgb(0,0,0);">x</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(0,0,0);">b1</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(0,0,0);text-decoration:underline;">stopgoclick</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(160,32,240);">if</span> <span style="color:rgb(0,0,0);">b1</span><span style="color:rgb(92,92,92);">==</span><span style="color:rgb(188,143,143);">5</span><span style="color:rgb(100,174,100);font-style:italic;">//right mouse: break loop </span>
<span style="color:rgb(95,158,160);">break</span>
<span style="color:rgb(160,32,240);">end</span>
<span style="color:rgb(160,32,240);">end</span>
<span style="color:rgb(188,143,143);">'</span><span style="color:rgb(188,143,143);">further commands</span><span style="color:rgb(188,143,143);">'</span></font></pre>
If that is o.k. could you help me to handle the loop break case
from inside the function?<br>
Cheers<br>
Jens<br>
--------------------------------------------<br>
<br>
<div class="moz-cite-prefix">Am 22.11.2016 01:36, schrieb Tim
Wescott [via Scilab / Xcos - Mailing Lists Archives]:<br>
</div>
<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' cite="mid:1479774889.6116.91.camel@Servo" type="cite">
xclick() <br>
<br>
On Mon, 2016-11-21 at 17:22 -0700, Jens wrote:
<div class="shrinkable-quote"><br>
> Hallo Scilab users, <br>
> I am searching for a convenient way to restart a loop
with only *one* key <br>
> or mouse stroke. The loop may generate and show graphics
or not. I tried <br>
> xclick, pause, halt, and input with little success. input
is closest to the <br>
> target but not close enough. <br>
> <br>
> for i=1:3 <br>
> plot() <br>
> //commands wanted which stops the loop and
continues it with ONE key <br>
> or mouse stroke only. <br>
> //input('click on console and press return')// very
close but more <br>
> than one stroke <br>
> xdel(); <br>
> end <br>
> <br>
> <br>
> <br>
> -- <br>
> View this message in context: <a moz-do-not-send="true"
href="http://mailinglists.scilab.org/Start-an-arrested-loop-with-one-keystroke-only-tp4035053.html"
target="_top" rel="nofollow" link="external">http://mailinglists.scilab.org/Start-an-arrested-loop-with-one-keystroke-only-tp4035053.html</a><br>
> Sent from the Scilab users - Mailing Lists Archives
mailing list archive at Nabble.com. <br>
> _______________________________________________ <br>
> users mailing list <br>
> <a moz-do-not-send="true"
href="/user/SendEmail.jtp?type=node&node=4035055&i=0"
target="_top" rel="nofollow" link="external">[hidden email]</a>
<br>
> <a moz-do-not-send="true"
href="http://lists.scilab.org/mailman/listinfo/users"
target="_top" rel="nofollow" link="external">http://lists.scilab.org/mailman/listinfo/users</a><br>
> <br>
> </div>
<br>
-- <br>
<br>
Tim Wescott <br>
<a moz-do-not-send="true" class="moz-txt-link-abbreviated"
href="http://www.wescottdesign.com" target="_top" rel="nofollow" link="external">www.wescottdesign.com</a>
<br>
Control & Communications systems, circuit & software
design. <br>
Phone: 503.631.7815 <br>
Cell: 503.349.8432 <br>
<br>
<br>
_______________________________________________ <br>
users mailing list <br>
<a moz-do-not-send="true"
href="/user/SendEmail.jtp?type=node&node=4035055&i=1"
target="_top" rel="nofollow" link="external">[hidden email]</a>
<br>
<a moz-do-not-send="true"
href="http://lists.scilab.org/mailman/listinfo/users"
target="_top" rel="nofollow" link="external">http://lists.scilab.org/mailman/listinfo/users</a><br>
<br>
<br>
<hr noshade="noshade" size="1" color="#cccccc">
<div style="color:#444; font: 12px
tahoma,geneva,helvetica,arial,sans-serif;">
<div style="font-weight:bold">If you reply to this email, your
message will be added to the discussion below:</div>
<a moz-do-not-send="true"
href="http://mailinglists.scilab.org/Start-an-arrested-loop-with-one-keystroke-only-tp4035053p4035055.html" target="_top" rel="nofollow" link="external">http://mailinglists.scilab.org/Start-an-arrested-loop-with-one-keystroke-only-tp4035053p4035055.html</a>
</div>
<div style="color:#666; font: 11px
tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
To unsubscribe from Start an arrested loop with one keystroke
only, <a moz-do-not-send="true"
href="" target="_top" rel="nofollow" link="external">click
here</a>.<br>
<a moz-do-not-send="true"
href="http://mailinglists.scilab.org/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_top" link="external">NAML</a> </div>
</blockquote>
<br>
</blockquote>
<br>
<br/><hr align="left" width="300" />
View this message in context: <a href="http://mailinglists.scilab.org/Start-an-arrested-loop-with-one-keystroke-only-tp4035053p4035059.html">Re: Start an arrested loop with one keystroke only</a><br/>
Sent from the <a href="http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html">Scilab users - Mailing Lists Archives mailing list archive</a> at Nabble.com.<br/>