Error using area plot in App Designer

3 ビュー (過去 30 日間)
Elvia Rosas
Elvia Rosas 2020 年 12 月 1 日
編集済み: Elvia Rosas 2020 年 12 月 2 日
How can I use area plot in App Desiigner. I am using this code to show the area behide the curve of a function, in order to show the integration area.
This is the code:
f = str2func(app.FuncinEditField.Value)
a = app.aEditField.Value
b = app.bEditField.Value
n = app.nEditField.Value
fplot(app.UIAxes,f, [0,10])
hold(app.UIAxes,"on")
x= linspace(a,b)
y = f(x)
area(app.UIAxes,x,y)
I get this error at area(app.UIAxes,x,y) line: Unable to use a value of type matlab.ui.control.UIAxes as an index.
Thank you for your help

採用された回答

Benjamin Kraus
Benjamin Kraus 2020 年 12 月 2 日
編集済み: Benjamin Kraus 2020 年 12 月 2 日
I think you've created a variable with the name area somewhere in your code.
Can you add this code, immediate above the line of code that is calling the area command?
which -all area
whos area
  • The which command will tell you if there is another file called area shadowing the built-in copy of area, or if area is the name of a variable in your workspace. Look at the first line of output to see if it says "area is a variable."
  • The whos command will tell you about the variable area if it exists in your workspace.
  1 件のコメント
Elvia Rosas
Elvia Rosas 2020 年 12 月 2 日
編集済み: Elvia Rosas 2020 年 12 月 2 日
Thank you very much Benjamin!, It works!, That was the problem

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

その他の回答 (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