Passing variable from one sub functions to another (GUI)
7 次查看(过去 30 天)
显示 更早的评论
Hi, I need to use 2 numbers inputted in a textbox to make a plot in GUI. But it seems that variables are not visible for other function. How can I refer to varX1 and varY1.
function x1_Callback(hObject, eventdata, handles)
varX1=get(handles.x1,'string');
varX1=str2double(varX1);
function y1_Callback(hObject, eventdata, handles)
varY1=get(handles.y1,'string');
varY1=str2double(varY1);
function startDisplay_Callback(hObject, eventdata, handles)
plot(varX1,varY1);
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Scope Variables and Generate Names 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!