0% found this document useful (0 votes)
49 views2 pages

Function: 'String' 'String' 'String' 'String'

This document contains the code for three callback functions: 1) pushbutton1_Callback performs calculations using input values from several edit boxes to determine values for P, fE and fF, and displays P in an edit box. 2) pushbutton2_Callback clears the values in all the edit boxes. 3) pushbutton3_Callback closes the GUI window.

Uploaded by

Javier Fc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views2 pages

Function: 'String' 'String' 'String' 'String'

This document contains the code for three callback functions: 1) pushbutton1_Callback performs calculations using input values from several edit boxes to determine values for P, fE and fF, and displays P in an edit box. 2) pushbutton2_Callback clears the values in all the edit boxes. 3) pushbutton3_Callback closes the GUI window.

Uploaded by

Javier Fc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

function pushbutton1_Callback(hObject, eventdata, handles)

x=str2num(get(handles.edit1,'string'));
y=str2num(get(handles.edit2,'string'));
z=str2num(get(handles.edit3,'string'));
a=str2num(get(handles.edit4,'string'));
n=length(x);
D=zeros(n,n);
for k=1:n
for j=1:n
D(k,j)=z(k,j)
end
end
if a(1)<=a(2)
for i=2:n
if a(2)<y(i)
b1=y(i-1);
b2=y(i);
m=i-1;
n=i;
break
end
end
for h=2:n
if a(1)<x(h)
a1=x(h-1);
a2=x(h);
p=h-1;
t=h;
break
end
end
else
for h=2:n
if a(1)<x(h)
a1=x(h-1);
a2=x(h);
p=h-1;
t=h;
break
end
end
for i=2:n
if a(2)<y(i)
b1=y(i-1);
b2=y(i);
m=i-1;
n=i;
break
end
end
end
fE=((b2-a(2))./(b2-b1)).*D(p,m)+((a(2)-b1)./(b2-b1)).*D(p,n);
fF=((b2-a(2))./(b2-b1)).*D(t,m)+((a(2)-b1)./(b2-b1)).*D(t,n);
P=(a2-a(1)./(a2-a1)).*fE+((a(1)-a1)./(a2-a1)).*fF;
set(handles.edit5,'string',P);

PARA LIMPIAR
function pushbutton2_Callback(hObject, eventdata, handles)
set(handles.edit1,'string',' ');
set(handles.edit2,'string',' ');
set(handles.edit3,'string',' ');
set(handles.edit4,'string',' ');
set(handles.edit5,'string',' ');

CLOSE

function pushbutton3_Callback(hObject, eventdata, handles)


close

You might also like