Hello,
You can use "resume" to return values in caller environment.
In case of callbacks from gui interaction, caller is always "console" scope.
In your callback do something like "data = resume(a);"
That's create or overwrite "data" with the contents of "a"
Example :
xdel(winsid());
clear createGUI callbackFromGui;
function createGUI()
f = figure(...
"dockable", "off", ...
"axes_size", [300 100], ...
"infobar_visible", "off", ...
"toolbar", "none", ...
"menubar_visible", "on", ...
"menubar", "none", ...
"default_axes", "off", ...
"background", color(255, 255, 255));
uicontrol(f, ...
"style", "pushbutton", ...
"string", "Send variable in console context", ...
"position", [(300 - 200)/2 (100 - 25)/2 200 25], ...
"callback", "callbackFromGui");
endfunction
function callbackFromGui()
a = rand(10, 10);
data = resume(a);
endfunction
createGUI();
After clicking on the button, you should have a "data" variable in the
console.
Regards,
Antoine
Le 10/05/2019 à 14:18, Stéphane Mottelet a écrit :
Le 10/05/2019 à 11:42, Hani Andreas Ibrahim a écrit :
I wrote a SCE-Script where you can read datafiles into a matrix and
specify the import parameter AND the name of matrix where the data is
stored in a GUI. Because variables in sce are visible to Scilab I
could work with the matrix which name was specified in the GUI in
Scilab's console.
Now I wrote a toolbox where I call this script from a menu item
(addmenu) with exec("myscrip.sce",-1). The toolbox works fine so far
and run the script properly but the matrix variable is not visible in
Scilab. Obviously Scilab handles variables in sce in a toolbox
differently?
The script itself works fine and provide the variable if I run the
sce directly outside the toolbox. The sce has no dependencies to
external SCIs.
Who can I make this variable visible for Scilab from a toolbox?
Thanks, Hani
PS: The toolbox should run on Scilab 5.5.x and 6.0.x.
_______________________________________________
users mailing list
users@lists.scilab.org
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
Hello,
Please give us a small and reproductive example, under the form of two
scripts (the one creating the menu and the one executed by selecting
the menu item).
S.
--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet
_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users