Help plotting user input functions for Matlab App.
古いコメントを表示
Hi all,
I have a project where I am trying to build an app which can plot simple user functions (such as quadratic, trignometric etc). I have an edit field text where the users will be able to add thier functions in. I want it so users do not have to include 'y =' into their function, but can rather type the components with x in it. eg. they could type 2x and that would be 'y=2x' or '5x^2 + 3' would be 'y=5x^2 + 3'. I have used the callback function and included the code within:
function EnterFunctionEditFieldValueChanged(app, event)
value = app.EnterFunctionEditField.Value;
x = -10:0.1:10;
y = value;
plot (app.UIAxes, x, y);
end
Now I am aware that the issue is probably with the 'y=value;' bit, but I really don't know any way to move foreward. The error message I get is 'Error using plot Invalid color or line style'. It is to be noted that when I only insert x into the textbox, I do get a function (with error lines I believe). See below: All help is appriciated.

採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

