Reference to nonexistent field 'xdot1'.

2 ビュー (過去 30 日間)
Jett Tom
Jett Tom 2021 年 5 月 1 日
回答済み: Walter Roberson 2021 年 5 月 1 日
I'm trying to create a GUI and want to input values and have the GUI plot a graph based on these values. Under the callback function for edit1 to edit4 I have the same code but the x1 after handles is x1, xdot1, x2 and xdot2, respectively. When I try to run it and put the values into my GUI, I keep getting the error "Reference to nonexistent variable 'xdot1'. Is there a way to eliminate this error so the GUi creates a graph?
This is my GUI:
This is the graph I am trying to create:

回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 5 月 1 日
In your OpenFcn initialize the edit field String properties, and initialize the handles.* values appropriately.
Alternatively, do not bother with the edit callbacks unless you want to do input validation. Instead, retrieve the values from the edit fields right in your calculation function.

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by