現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
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!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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 (한국어)