From: Edwin on
hello everybody,
I have made a GUI with guide.The goal of the GUI I made is to get input data and save the filenames in the workspace, I have done that but then what I want is that one button in the GUI executes an external function anyone could give me any idea.

the user can push either analysis1 or analysis2 button which should execute some external function which is called dist_histo_nadv12modfmain.m, this external function then call other subfunction within it.


any help would be greatly appreciate it.

regards


below is a small part of my GUI code
--------------------------------------------------------------------------------------------------------------------
function prueba2nad(varargin)
%

% --- Executes on button press in filename1.
function filename1_Callback(hObject, eventdata, handles)
% hObject handle to filename1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[FileName,PathName] = uigetfile('*.*','Select Seismicity file');
%file = strcat(PathName,FileName)
%evalin('base',['load ' FileName]);
fname = fullfile(PathName, FileName);
%answer = inputdlg(prompt,title,lines,def);
assignin('base','A',fname);
%assignin('base','cmap',answer{2});

% --- Executes on button press in filename2.
function filename2_Callback(hObject, eventdata, handles)
% hObject handle to filename2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename, pathname] = ...
uigetfile({'*.txt';'*.mat';'*.*'},'Select Source zones file');
NAME = [pathname,filename]; %path and name
%evalin('base',['load ' filename]);
%name = fullfile('', filename);
%answer = inputdlg(prompt,title,lines,def);
assignin('base','name',filename);


% --- Executes on button press in analysis1.
function analysis1_Callback(hObject, eventdata, handles)
% hObject handle to analysis1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
assignin('base','opt',2);
pe = get(handles.input1_editText,'String');
T = get(handles.input2_editText,'String');
assignin('base','pe',pe);
assignin('base','T',T);
dist_histo_nadv12modfmain
%dist_histo_nadv12modfmain(A,BB,name,pe,T)
close(handles.figure1)



% --- Executes on button press in analysis2.
function analysis2_Callback(hObject, eventdata, handles)
% hObject handle to analysis2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
assignin('base','BC',BB);
clear BB
assignin('base','opt',1);
pe = get(handles.input1_editText,'String');
T = get(handles.input2_editText,'String');
assignin('base','pe',pe);
assignin('base','T',T);
dist_histo_nadv12modfmain
%dist_histo_nadv12modfmain(A,BC,name,pe,T)
close(handles.figure1)


% --- Executes on button press in exit.
function exit_Callback(hObject, eventdata, handles)
% hObject handle to exit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close(handles.figure1)





function input1_editText_Callback(hObject, eventdata, handles)
% hObject handle to input1_editText (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of input1_editText as text
% str2double(get(hObject,'String')) returns contents of input1_editText as a double
input = str2num(get(hObject,'String'));
if (isempty(input))
set(hObject,'String','0')
end
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function input1_editText_CreateFcn(hObject, eventdata, handles)
% hObject handle to input1_editText (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
 | 
Pages: 1
Prev: What does this mean???
Next: mex file crashed