function error in matlab app desinger

1 回表示 (過去 30 日間)
Abdulrahman Mohamed
Abdulrahman Mohamed 2022 年 3 月 24 日
回答済み: Rishav 2023 年 10 月 5 日
I tried to use app function as helper function in app desinger
but i got error that Illegal use of reserved keyword "methods".
this is the function
methods (Access = private)
function result=belladead(app,Rs,T,API);
a=10^(0.43+(8.33/API));
x1=(1.8*10^7)/(API^4.53);
x2=(360/(T-260))^a;
uod=(0.32+x1)*(x2);
result=uod;
end
end
this is the call back function
value = app.SelectCorrelationDropDown.Value;
Rs=app.RsSCFSTBEditField.Value;
T=app.TREditField.Value;
API=app.APIEditField.Value;
switch app.SelectCorrelationDropDown.Value
case 'Beal’s Correlation'
g=belladead(app,Rs,T,API);
app.uodcpEditField.Value=g;
case 'Glaso’s Correlation'
a=10.313*(log10(T-460))-36.447
uod1=(3.141*(10^10))*((T-460)^-3.444)*(log10(API))^a;
app.uodcpEditField.Value=uod1;
otherwise
disp("please select correlation")
end

回答 (1 件)

Rishav
Rishav 2023 年 10 月 5 日
Hi Abdulrahman,
I understand that you are getting the error 'Illegal use of reserved keyword "methods"' while writing a helper function.
There are two possible reasons for this error:
  1. You are not defining this method inside a class.
  2. You are defining this method inside of another method of the same class.
Thank you,
Rishav Saha

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by