Hi Petar,
From the code you provided, you may have consulted the Openeering tutorial "How to develop a GUI in Scilab".
With regards to the detailed example in that tutorial, it seems possible to reuse the newly input GUI input parameters (par variable) if:
- the par(k) variable is not reset inside syscompute function (par =[]);
- the par(k) variable is declared inside (and outside) syscompute as global
- the GUI figure is closed and reopened before reusing the new input parameters
Not sure if this is might be the source of your problem nor if all the points above are necessary or correct but, hopefully the example below that seems to work may help you:
global par;
function syscompute(par)
global par;
Q = findobj("tag", "Q"); par(1) = evstr(Q.string);
dpTot = findobj("tag", "dpTot"); par(2) = evstr(dpTot.string);
y = par(1)*sqrt(par(2)); // or call some function from here
printf("Q= %.3f, dpTot= %.3f\n",par(1),par(2));
printf("Result = %.3f\n\n",y);
endfunction
f=figure();
labels1=["Q","dpTot"];
values1=[0,0];
par = values1;
for k=1:size(labels1,2)
uicontrol("parent",f,"style","text","string",labels1(k),"position",[0,300-k*20,100,20]);
guientry1(k)=uicontrol("parent",f,"style","edit","string",string(values1(k)),"position",...
[100,300-k*20,50,20],"tag",labels1(k));
end
hb = uicontrol(f, "style","pushbutton", ...
"Position",[50 200 100 20], "String","Compute", ...
"Callback","syscompute");
input("Input new values in GUI, hit Compute, then ENTER here to continue...","string");
// Show below the reusability of newly input GUI parameters (above):
close(f);
f=figure();
for k=1:size(labels1,2)
values1(k)= par(k);
uicontrol("parent",f,"style","text","string",labels1(k),"position",[0,300-k*20,100,20]);
guientry1(k)=uicontrol("parent",f,"style","edit","string",string(values1(k)),"position",[100,300-k*20,50,20],"tag",labels1(k));
end
hb = uicontrol(f, "style","pushbutton", ...
"Position",[50 200 100 20], "String","Compute", ...
"Callback","syscompute");
input("Do Compute in GUI then ENTER here to continue......","string")
close(f)
Regards,
Rafael