How to store variables in Matlab GUI
Show older comments
Hi,
I am having trouble to store variables in Matlab GUI. I really couldn't grasp the concept of handles without an example.
So below is my GUI. What I'm trying to do is to (1) load my data based on the criteria from the two textboxes, (2) perform analyses and (3) plot the result by clicking the plot button. But for the sake of this question, let's simplify the problem into: (1) load Stock ID and Year by clicking Load Button and (2) plot the two points.
Now, how do I use guidata() to store variables yearid and sid so that I can call them on another function? Thanks a lot. Aditya
methods (Access = private)
% Button pushed function: LoadDataButton
function LoadDataButtonPushed(app, event)
% get the year ID from the YearEditField
yearid = app.YearEditField.Value;
% get the stock ID from the YearEditField
sid = app.StockIDEditField.Value;
end
% Button pushed function: DisplayPlotButton
function DisplayPlotButtonPushed(app, event)
plot(yearid, sid) % <--------- Problem???
end
end

Accepted Answer
More Answers (0)
Categories
Find more on App Building in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!