이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
why after making my executable gui some buttons do not work?
조회 수: 6 (최근 30일)
이전 댓글 표시
I made a gui that links another 9 more, each one has a method in which it calculates and graphs. Before making it executable they worked for me but after doing it an .exe file and opening it some buttons do not work, why?
답변 (1개)
Walter Roberson
2017년 11월 5일
Did you specifically tell the compiler to add the files for the other GUIs ? If you used GUIDE then because of the way it constructs callbacks, it would be common for the compiler to not be able to figure out that some files were needed. You would need to either add the files specifically or you would need to use %#function pragmas. https://www.mathworks.com/help/compiler_sdk/ml_code/function.html
댓글 수: 13
Erwin Avendaño
2017년 11월 5일
If when I was asking for the files I needed to start the program add all the m files. and figure of each guide that used the program some buttons if they serve those that have simple actions such as delete, graph but the button calculate that takes in the method of how to solve, send results that button does not work what would it do? I'm really anguished it took me 5 days to do my program since it has 9 methods, graphics I do not want to lose everything: /
Walter Roberson
2017년 11월 5일
Can you attach your code (zip it all up and attach the zip), along with a description of how you did the compiling, and also the steps that would be needed to reproduce the problem? If a data file is needed, include a sample data file so we can test.
Erwin Avendaño
2017년 11월 5일
are 10 codes I repeat are 9 methods and the guide 10 is the main window. I will attach a code so that I can analyze if it has something bad but I repeat I try it and if it works but the error arises after compiling and executing the .exe some buttons no longer work, well only the calculating one no longer works. In a moment I attach a code and I show how to compile
Erwin Avendaño
2017년 11월 5일
As a question, does it have anything to do with those orange stripes that appear on the right side? some I gave fix but not even an I function in the executable
Erwin Avendaño
2017년 11월 5일
function varargout = metodo2(varargin) % METODO2 MATLAB code for metodo2.fig % METODO2, by itself, creates a new METODO2 or raises the existing % singleton*. % % H = METODO2 returns the handle to a new METODO2 or the handle to % the existing singleton*. % % METODO2('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in METODO2.M with the given input arguments. % % METODO2('Property','Value',...) creates a new METODO2 or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before metodo2_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to metodo2_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help metodo2
% Last Modified by GUIDE v2.5 05-Nov-2017 10:22:45
% Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @metodo2_OpeningFcn, ... 'gui_OutputFcn', @metodo2_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end
if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT
% --- Executes just before metodo2 is made visible. function metodo2_OpeningFcn(hObject, ~, handles, varargin) movegui(gcf,'center')
axes(handles.axes1) imshow('logo.jpg') axes(handles.axes3) imshow('recuadro.jpg') axes(handles.axes4) imshow('recuadro.jpg') axes(handles.axes5) imshow('recuadro.jpg') axes(handles.axes6) imshow('recuadro.jpg') axes(handles.axes7) imshow('recuadro.jpg') axes(handles.axes11) imshow('recuadro.jpg') axes(handles.axes12) imshow('biseccion.jpg')
handles.output = hObject;
% Update handles structure guidata(hObject, handles);
% UIWAIT makes metodo2 wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. function varargout = metodo2_OutputFcn(~, ~, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure varargout{1} = handles.output;
function edit1_Callback(~, ~, ~) % hObject handle to edit1 (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 edit1 as text % str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties. function edit1_CreateFcn(hObject, ~, ~) % hObject handle to edit1 (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
% --- Executes during object creation, after setting all properties. function axes1_CreateFcn(~, ~, ~) % hObject handle to axes1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes1
function pushbutton1_Callback(~, ~, ~) % hObject handle to pushbutton1 (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 pushbutton1 as text % str2double(get(hObject,'String')) returns contents of pushbutton1 as a double
% --- Executes on button press in pushbutton3. function pushbutton3_Callback(~, ~, handles) syms x %variable simbolica x f=get(handles.edit8,'string'); xl=str2double(get(handles.edit3,'string')); xu=str2double(get(handles.edit5,'string')); tol=str2double(get(handles.edit4,'string')); E=100; xa=100; i=0; while(tol<E) xr=(xl+xu)/2; fxl=subs(f,x,xl); fxr=subs(f,x,xr); m=fxl*fxr; if(m)<0
xu=xr;
else
xl=xr;
end
E=abs(xr-xa);
xa=xr;
i=i+1;
end
xr;
vpa(E,5)
set(handles.edit6,'string',xr);
set(handles.edit9,'string',E);
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(~, ~, handles)
f=inline(get(handles.edit8,'string')); xl=str2double(get(handles.edit3,'string')); xu=str2double(get(handles.edit5,'string'));
if xl~=xu axes(handles.axes2); ezplot(f,[xl,xu]),grid on; else axes(handles.axes2); ezplot(f),grid on;
end function edit3_Callback(~, ~, ~)
% --- Executes during object creation, after setting all properties. function edit3_CreateFcn(hObject, ~, ~) % hObject handle to edit3 (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
function edit4_Callback(~, ~, ~)
% --- Executes during object creation, after setting all properties. function edit4_CreateFcn(hObject, ~, ~) % hObject handle to edit4 (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
function edit5_Callback(~, ~, ~)
% --- Executes during object creation, after setting all properties. function edit5_CreateFcn(hObject, ~, ~) % hObject handle to edit5 (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
function edit6_Callback(~, ~, ~)
function edit6_CreateFcn(hObject, ~, ~) % hObject handle to edit6 (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
% --- Executes during object creation, after setting all properties. function edit7_CreateFcn(~, ~, ~) % hObject handle to edit7 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
function edit8_Callback(~, ~, ~) % hObject handle to edit8 (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 edit8 as text % str2double(get(hObject,'String')) returns contents of edit8 as a double
% --- Executes during object creation, after setting all properties. function edit8_CreateFcn(hObject, ~, ~) % hObject handle to edit8 (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
% --- Executes during object creation, after setting all properties. function axes2_CreateFcn(~, ~, ~) % hObject handle to axes2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes2
function edit9_Callback(~, ~, ~) % hObject handle to edit9 (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 edit9 as text % str2double(get(hObject,'String')) returns contents of edit9 as a double
% --- Executes during object creation, after setting all properties. function edit9_CreateFcn(hObject, ~, ~) % hObject handle to edit9 (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
% --- Executes on button press in pushbutton5. function pushbutton5_Callback(~, ~, ~) close(metodo2); metodo1
% --- Executes on button press in pushbutton6. function pushbutton6_Callback(~, ~, handles) set (handles.edit8, 'String', ''); set (handles.edit3, 'String', ''); set (handles.edit5, 'String', ''); set (handles.edit4, 'String', ''); set (handles.edit9, 'String', ''); set (handles.edit6, 'String', ''); axes(handles.axes2); cla reset
% --- Executes during object creation, after setting all properties. function axes12_CreateFcn(~, ~, ~) % hObject handle to axes12 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes12
% --- Executes during object creation, after setting all properties. function pushbutton4_CreateFcn(~, ~, ~) % hObject handle to pushbutton4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% --- Executes during object creation, after setting all properties. function axes5_CreateFcn(~, ~, ~) % hObject handle to axes5 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes5
Erwin Avendaño
2017년 11월 5일
편집: Walter Roberson
2017년 11월 6일
syms x %variable simbolica x
f=get(handles.edit8,'string');
xl=str2double(get(handles.edit3,'string'));
xu=str2double(get(handles.edit5,'string'));
tol=str2double(get(handles.edit4,'string'));
E=100;
xa=100;
i=0;
while(tol<E)
xr=(xl+xu)/2;
fxl=subs(f,x,xl);
fxr=subs(f,x,xr);
m=fxl*fxr;
if(m)<0
xu=xr;
else
xl=xr;
end
E=abs(xr-xa);
xa=xr;
i=i+1;
end
xr;
vpa(E,5)
set(handles.edit6,'string',xr);
set(handles.edit9,'string',E);
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(~, ~, handles)
f=inline(get(handles.edit8,'string'));
xl=str2double(get(handles.edit3,'string'));
xu=str2double(get(handles.edit5,'string'));
if xl~=xu
axes(handles.axes2);
ezplot(f,[xl,xu]),grid on;
else
axes(handles.axes2);
ezplot(f),grid on;
end
Walter Roberson
2017년 11월 6일
The cause of this is the same as https://www.mathworks.com/matlabcentral/answers/365294-does-my-code-have-an-error#answer_289606 . It even looks to me as if that is a duplicate question . Duplicate questions keep the volunteers spending time cleaning up questions instead of spending time answering the questions.
참고 항목
카테고리
Help Center 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
태그
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)