MATLAB Answers

I have fixed parameters , and the functions will used it but how write in GUI MATLAB

1 ビュー (過去 30 日間)
Shahd Altalhi
Shahd Altalhi 2019 年 11 月 13 日
コメント済み: Ajay Kumar 2019 年 11 月 13 日
%common parameters
f=3.5;
pt=40;
pr=27;
n=6;
ht=5;
hr=0.005;
this is my parametrs , i want if function need one of the can use it direct , how ? by using guide

  0 件のコメント

サインイン to comment.

採用された回答

Ajay Kumar
Ajay Kumar 2019 年 11 月 13 日
編集済み: Ajay Kumar 2019 年 11 月 13 日
If you have static parameters which you do not want to change through out the program, you can declare them in OpeningFcn callback of GUI.
Everytime you open the GUI, these parameters are set.
function untitled1_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to untitled1 (see VARARGIN)
handles.f=3.5;
handles.pt=40;
handles.pr=27;
handles.n=6;
handles.ht=5;
handles.hr=0.005;
% Choose default command line output for untitled1
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);

  2 件のコメント

Shahd Altalhi
Shahd Altalhi 2019 年 11 月 13 日
how to call them in other functions, can you give examle of the syntax ?
Ajay Kumar
Ajay Kumar 2019 年 11 月 13 日
For calling the variables, you need to get these handles as the parameters for the function.
For example:
function sample_function(hObject, eventdata, handles, ...%some more user defined if you want )
% do something
% you can call your handles variables here directly. for eg: x = handles.f + 1;
end

サインイン to comment.

その他の回答 (0 件)

サインイン してこの質問に回答します。

タグ


Translated by