Functions

Luciana Liria lucianavliria at hotmail.com
Tue Apr 6 13:45:05 CEST 2010


I am writing this email because i have some problems with Scilab.
Firstly,i have one .sce file in wich a programmed two radiobuttoms with some
sentences to select only one each time. 
When i run this .sce file i do not have problems. But this .sce file is
called from a previous one. And when i do this, the radiobuttoms  
do not work as i hope. There is an "error 4" with Valor2_opc and Valor_opc
,i know that this error means "Undefined variable", but the Valor2_opc 
and Valor_opc are not variables, are functions. 
These are the sentences of the .sce file where are the functions:

v_opc = figure(1, ...
"figure_name", "Primer orden sistema mecanico",...
"backgroundcolor", [0.6 0.2 0.2], ...
"position", [200 100 600 400]);

delmenu(v_opc.figure_id, ...
gettext("&File"));
delmenu(v_opc.figure_id, ...
gettext("&Tools"));
delmenu(v_opc.figure_id, ...
gettext("&Edit"));
delmenu(v_opc.figure_id, ...
gettext("&?"));
toolbar(v_opc.figure_id, "off");

m1_opc = uimenu(v_opc, ...
"label", "Archivo");
m11_opc = uimenu(m1_opc, ...
"label", "Salir", ...
"callback", "exit");
m2_opc = uimenu(v_opc, ...
"label", "Ayuda");
m21_opc = uimenu(m2_opc,...
"label", "Acerca de", ...
"callback", "about()");

marco_opc = uicontrol( v_opc, ...
"style", "frame", ...
"relief", "groove", ...
"units", "pixels", ...
"position", [50 20 500 350],...
"background", [0.8 0.8 0.8]);

tit_opc = uicontrol(marco_opc, ...
"style", "text", ...
"string", "Elija una opcion: ", ...
"position", [30 300 150 45], ...
"backgroundcolor", [0.8,0.8, 0.8], ...
"fontname","Times",...
"fontsize", 20, ...
"fontweight", "demi", ...
"horizontalalignment", "center");

Primer_Orden_opc = uicontrol(marco_opc, ...
"style" , "radiobutton", ...
"string" , "Analogias con modelos de Primer Orden", ...
"position", [110 260 350 50], ...
"fontname","Times",...
"fontsize", 12, ...
"fontweight", "bold", ...
"min", 0, "max", 1, ...
"value", 1, ...
"callback","Validar_opc",...
"background", [0.8 0.8 0.8]);

lista1_opc = uicontrol(marco_opc, ...
"style", "listbox", ...
"position", [200 160 200 100], ...
"string", ...
["Analogia con modelo mecanico", "Analogia con modelo termico"], ...
"fontname","Times",...
"fontsize", 12, ...
"fontweight", "bold", ...
"backgroundcolor", [0.8 0.8 0.8]);

Segundo_Orden_opc = uicontrol(marco_opc, ...
"style" , "radiobutton", ...
"string" , "Analogias con modelos de Segundo Orden", ...
"position", [110 150 350 50], ...
"fontname","Times",...
"fontsize", 12, ...
"fontweight", "bold", ...
"min", 0, "max", 1, ...
"value", 0, ...
"callback","Validar2_opc",...
"background", [0.8 0.8 0.8]);


lista2_opc = uicontrol(marco_opc, ...
"style", "listbox", ...
"position", [200 60 200 80], ...
"string", ...
["Analogia con modelo mecanico", "Analogia con modelo termico"], ...
"fontname","Times",...
"fontsize", 12, ...
"fontweight", "bold", ...
"backgroundcolor", [0.8 0.8 0.8]);

Aceptar_opc = uicontrol(marco_opc, ...
"style", "pushbutton", ...
"position", [400 20 70 35], ...
"backgroundcolor",[0.7 0.6 0.6], ...
"foregroundcolor", [0 0 0], ...
"string", "Aceptar",...
"fontsize",12, ...
"fontweight", "bold",...
"relief","sunken",...
"callback", "Simulacion");

function Validar_opc
set(Primer_Orden_opc,'value',1); 
set(Segundo_Orden_opc,'value',0);
endfunction

function Validar2_opc 
set(Primer_Orden_opc,'value',0); 
set(Segundo_Orden_opc,'value',1);
endfunction

function Simulacion
clf(v_opc);
exec('Primer_Orden_Mecanico.sce');
endfunction

 
Well, i hope you can help me to solve this problem. 
Yours faithfully,
Luciana Liria
 		  		 	   		  
_________________________________________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20100406/89f4eda7/attachment.htm>


More information about the users mailing list