<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hi Antoine<br>
<br>
Thank you for your suggestion, which almost does what I need. The
users are not necessarily Scilab users, so I'd like a user
interface where the result is also displayed.<br>
<br>
I realize I could show a messagebox with the result.<br>
<br>
What I'd like to do requires a single window/figure where input
and output is shown + a QUIT button so that the user always only
sees one single frame / user interface, as an application / for
simplicity (no Scilab).<br>
<br>
Later I will add a noise spectrum simulation + a filter - e.g. 2.
order high-pass butterworth at 2500 Hz. The filtered response will
reduce the voltage, but how much? The user should be informed
about before + after filter (3 inputs, 2 outputs) and dialog boxes
is not as nice when it's more complicated like this.<br>
<br>
Best regards,<br>
Claus<br>
<br>
On 01-Jun-14 11:41, Antoine ELIAS wrote:<br>
</div>
<blockquote cite="mid:538AF544.9080806@scilab-enterprises.com"
type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div class="moz-cite-prefix">Hi Claus,<br>
<br>
For small dialogs to ask inputs, use <b>x_mdialog</b> function
( <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://help.scilab.org/docs/5.5.0/fr_FR/x_mdialog.html">http://help.scilab.org/docs/5.5.0/fr_FR/x_mdialog.html</a>
)<br>
<tt><br>
</tt><tt>function result = compute_voltage()</tt><tt><br>
</tt><tt> txt = ['Power (Watt)';'Impedance (ohm)'];</tt><tt><br>
</tt><tt> values = <b>x_mdialog</b>('System
values',txt,['100';'8'])</tt><tt><br>
</tt><tt> if values <> [] then</tt><tt><br>
</tt><tt> w = values(1);</tt><tt><br>
</tt><tt> o = values(2);</tt><tt><br>
</tt><tt> w = eval(w);</tt><tt><br>
</tt><tt> o = eval(o);</tt><tt><br>
</tt><tt><br>
</tt><tt> if typeof(w) <> "constant" | int(w)
<> w | typeof(o) <> "constant" | int(o) <> o
then</tt><tt><br>
</tt><tt> error("bad value, integer values
expected");</tt><tt><br>
</tt><tt> end</tt><tt><br>
</tt><tt><br>
</tt><tt> result = sqrt(w * o);</tt><tt><br>
</tt><tt> else</tt><tt><br>
</tt><tt> result = [];</tt><tt><br>
</tt><tt> end</tt><tt><br>
</tt><tt>endfunction</tt><tt><br>
</tt><tt><br>
</tt><tt>voltage = compute_voltage()</tt><tt><br>
</tt><br>
Antoine<br>
<br>
<br>
Le 31/05/2014 22:01, Claus Futtrup a écrit :<br>
</div>
<blockquote cite="mid:538A34FD.1050505@gmail.com" type="cite">Hi
there <br>
<br>
I hope someone can help me make a simple GUI front end to my
script, preferably without using GUI Builder or guimaker,
because I think I'll understand better without using additional
tools. <br>
<br>
The GUI - a window containing two variable input: <br>
1. text + input box + text <br>
Again the input is a number, typically an integer (as in
"system power : 100 Watt"). 100 being the user variable input. <br>
2. text + input box + text <br>
A number, typically an intereger (as in "impedance : 8 ohm").
8 being the user variable input. <br>
<br>
The script will then based on 100 Watt into 8 ohm calculate the
voltage = sqrt(100*8). I will round the number to one decimal,
convert it to a string and create an answer, like "Input level :
28.3 Volt". <br>
<br>
The GUI should contain two buttons, e.g. an OK + a QUIT button.
The OK button runs the calculations. The quit button quits the
script (may as well quit Scilab). <br>
<br>
I've studied the GUI controls in Scilab already and I understand
the the old way of making a new window is: <br>
<br>
f = figure(); <br>
<br>
but it seems there's a new command in Scilab 5.5.0: <br>
<br>
f = createWindow(); <br>
<br>
The new method probably has its advantages, but the Scilab
manual doesn't really explain... can anybody explain to me? <br>
<br>
Can you use the same uicontrol commands with both methods? (can
I use examples found on the internet using "figure" and just
replace figure with createWindow?). It seems to me that the
examples in the createWindow gives uicontrol some inputs named
"units" - "normalized" - etc. - which are not present when
looking at old figure() examples. <br>
<br>
My next question will be, how do I create a uicontrol which
accepts a string input (as I need 2 of those). The uicontrol
documentation says the "Edit" style will do that. Funny, but
also a bit strange, that you can find all sorts of examples for
using uicontrol with checboxes, listboxes, radiobuttons,
pushbuttons, tables etc. - but no examples are provided with
this most useful editable string input ... (???) <br>
<br>
... hereafter I expect to evaluate the two strings (or if
they're returned as numbers, that's fine of course, I just don't
need the script to crash if something is not right). Then
execute my code. <br>
<br>
Best regards, <br>
Claus <br>
<br>
--- <br>
This email is free from viruses and malware because avast!
Antivirus protection is active. <br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://www.avast.com">http://www.avast.com</a> <br>
<br>
_______________________________________________ <br>
users mailing list <br>
<a moz-do-not-send="true" class="moz-txt-link-abbreviated"
href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<br>
<a moz-do-not-send="true" 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>
<pre class="moz-signature" cols="200">--
Antoine ELIAS
Software developer
-----------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles
Phone: 01.80.77.04.70
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.scilab-enterprises.com">http://www.scilab-enterprises.com</a></pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
<tr>
<td style='border:none;padding:0px 15px 0px 8px'>
<a href="http://www.avast.com/">
<img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" />
</a>
</td>
<td>
<p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
This email is free from viruses and malware because <a href="http://www.avast.com/">avast! Antivirus</a> protection is active.
</p>
</td>
</tr>
</table>
<br />
</body>
</html>