フィルターのクリア

error: Undefined function 'on' for input arguments of type 'double'. How can i fix this error (i use matlab app designer)?

1 回表示 (過去 30 日間)
Anne
Anne 2023 年 11 月 30 日
回答済み: Walter Roberson 2023 年 11 月 30 日
typefunction = app.TypefunctionEditField.Editable;
a = app.aEditField.Value
b = app.bEditField.Value
run = app.RunButton.ButtonPushedFcn
error= app.errorEditField.Value
fxi=str2func(typefunction);
number_of_iterations=0;
if fxi(a)*fxi(b)>0
result=NaN;
return
end
if fxi(a)==0
result=a;
return
elseif fxi(b)==0
result=b;
return
end
while(abs(a-b)>=error)
result=(a+b)/2;
if fxi(a)*fxi(result)<0
b=result;
else
a=result;
end
number_of_iterations=number_of_iterations+1;
end

回答 (1 件)

Walter Roberson
Walter Roberson 2023 年 11 月 30 日
typefunction = app.TypefunctionEditField.Editable;
fxi=str2func(typefunction);
typefunction contains something that includes "on" in function form.
Notice that you are not retrieving the text the user put into the field: you are retrieving the information about whether the field can be editted ('on') or not ('off')

カテゴリ

Help Center および File ExchangeC Shared Library Integration についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by