hi guys, i want to plot in GUI, i've tried this code.
古いコメントを表示
function calcbutton_Callback(hObject, eventdata, handles)
dis = sqrt((handles.mydata.b)^2 -4*(handles.mydata.a)*(handles.mydata.c));
ans1 = (-(handles.mydata.b) + dis) /(2*(handles.mydata.a));
ans2 = (-(handles.mydata.b) - dis) /(2*(handles.mydata.a))
set(handles.ans1, 'String', ans2);
set(handles.ans2, 'String', ans1);
function plotbutton_Callback(hObject, eventdata, handles)
x=0:10;
plot(x,handles.ans1, handles.axes1);
hold on;
plot(x,handles.ans2, handles.axes2);
But it displays:
Error using plot
Data must be a single matrix Y or a list of pairs X,Y.
採用された回答
その他の回答 (1 件)
Anisio Gomes
2016 年 1 月 3 日
3 件のコメント
Walter Roberson
2016 年 1 月 4 日
After the assignment to handles.ans2 you need to add
guidata(hObject, handles);
... like we said earlier.
Image Analyst
2016 年 1 月 4 日
Let us know if it's fixed now.
Anisio Gomes
2016 年 1 月 6 日
カテゴリ
ヘルプ センター および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!