Hi. So I've been trying to learn lot about GUI but I've been having a hard time with it. So I have a code in a workspace separate from my GUI called Proy. My coding involves solving a concentration problem using ODE. In my GUI, I call my other file like so: @Proy. Here is my Proy code:
function fun = Proy(t,x)global tiempoglobal kCa1 = x(1);Cb1 = x(2);Ca2 = x(3);Cb2 = x(4);Cao = 20;fun (1) = 1/tiempo*(Cao - Ca1) - (k*Ca1);fun (2) = -1/tiempo*Cb1 + (k*Ca1);fun(3) = 1/tiempo*(Ca1 - Ca2) - (k*Ca2);fun (4) = 1/tiempo*(Cb1 - Cb2)-(k*Ca2);fun = fun';
Here is my GUI code: (This code is under my calculate pushbutton callback)
global tiempoglobal teglobal Rglobal kcontenido = get(handles.opcion,'Value');switch contenido case 1 k = 0.0157; case 2 k = 0.12; case 3 k = 0.089; case 4 k = 0.35;endtiempo = eval(get(handles.residencia,'String'));xo = [0 0 0 0];if tiempo <= 10tint = [0,100];[t,x] = ode45 (@Proy, tint, xo);elseif tiempo <= 45tint = [0,250];[t,x] = ode45 (@Proy, tint, xo);elsetint = [0,450];[t,x] = ode45 (@Proy, tint, xo);endswitch (get(eventdata.NewValue,'Tag')) case 'sitime' te = eval(get(handles.TE,'String')); Ca1e = x(te,1); Cb1e = x(te,2); Ca2e = x(te,3); Cb2e = x(te,4); case 'notime' Ca1 = x(:,1) ; Cb1 = x(:,2); Ca2 = x(:,3); Cb2 = x(:,4); C = [Ca1 Cb1 Ca2 Cb2];end The tags for the radio buttons are: sitime and notime
Whenever I run my program, it shows me the following error:
No appropriate method, property, or field 'NewValue' for class 'matlab.ui.eventdata.ActionData'. Error in trialproy_>calcular_Callback (line 135) switch (get(eventdata.NewValue,'Tag')) Error in gui_mainfcn (line 95) feval(varargin{:}); Error in trialproy_ (line 42) gui_mainfcn(gui_State, varargin{:}); Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)trialproy_('calcular_Callback',hObject,eventdata,guidata(hObject)) Error while evaluating UIControl Callback.|
And here is a screenshot of my GUI:
%
Best Answer