フィルターのクリア

Get Values From User using Edit Field Numeric in App Designer

70 ビュー (過去 30 日間)
Erkin Karatas
Erkin Karatas 2019 年 12 月 9 日
回答済み: Subhadeep Koley 2020 年 1 月 8 日
Hi all, I want to get values from user for 4 parameters, then place them into the second part of the code.
% Callback function
function LengthEditFieldValueChanged(app, event)
global L
value = app.LengthEditField.Value;
L = value;
end
% Callback function
function DiameterEditFieldValueChanged(app, event)
global D
value1 = app.DiameterEditField.Value;
D = value1;
end
% Callback function
function RPMEditFieldValueChanged(app, event)
global n
value3 = app.RPMEditField.Value;
n = value3;
end
% Callback function
function reciprocatingtimesEditFieldValueChanged(app, event)
global S
value4 = app.reciprocatingtimesEditField.Value;
S = value4;
end
2nd part of the question
function ButtonPushed(app, event)
global a
global V_f
global L
global S
global n
global D
a = 10;
V_f = 15;
x = 1:50; %diameter
y = 1:50; %length
V_w = (V_f * pi * D * n)/(2*L*S);
for i = 1:length(y)
hor(i) = V_w * sqrt(2*y(i)/a);
i = i+1;
end
plot(y,hor, 'r')
hold on
for i=1:100;
k = y - i;
plot(k, hor, 'r')
hold on
m = -x - i;
plot(m, hor, 'b')
hold on
i= i +1;
end
end
end
  3 件のコメント
Erkin Karatas
Erkin Karatas 2019 年 12 月 9 日
While I was posting the first question, I got a connection error, and I also couldn’t find the question in my page. So I thought it’s not posted. Sorry about that, I will erase the first one.
Ankit
Ankit 2019 年 12 月 10 日
What are the problems you are facing? Your question is not clear. Could you please elaborate more about your question.

サインインしてコメントする。

採用された回答

Subhadeep Koley
Subhadeep Koley 2020 年 1 月 8 日
Hi, Erkin in App Designer instead of using the keyword global, you can declare the variables as Public Property, which can be used inside and out of the app. The attached zip file contains the app for your reference, where I have modified your functions.
Hope this helps!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by