Guide – run multiple commands simultaneously
4 views (last 30 days)
Show older comments
Hello,
I’m still new to GUIDE and have been toying around with it for some time. I’ve looked through http://www.mathworks.com/matlabcentral/fileexchange/24861-41-complete-gui-examples and understand a fair amount of what Matt posted and seen the majority of videos from Doug from his GUIDE blog posts ( http://blogs.mathworks.com/videos/category/gui-or-guide/). My end goal for learning GUIDE is to feed simulated data into my GUI and have it respond graphically. For learning purposes, I’m starting off trying to learn simple things and build my way up to the end goal. My current goal is to have a "fuel tank" deplete over time while another "tank" heats up simultaneously. Both these “tanks” are just going to be square axes.
For the fuel tank depleting, I thought I could get two axes of different colors - one representing fuel while the other represents emptiness. The “empty" axis would be growing longer, so it would appear that the “fuel” axis would be depleting.
As for the heating up tank, I can use the fill command to change its color over time, which I can already do.
I would like to be able to show both at the same time. Can someone please point me in the right direction?
2 Comments
Accepted Answer
Walter Roberson
on 21 May 2012
An axes is a portion of a screen within which you can put graphics. You would not often want to change the size of your axes as the program runs, but you might change the size of something you have drawn in the axes.
I suggest you consider using a single axes, and two rectangle() commands that represent the outside of the fuel tanks, and two filled rectangle() commands that represent the volume or heat.
It is not possible to run multiple MATLAB graphics command simultaneously. Even if you had the Parallel Computing Toolbox, or were to spawn additional Java processes, all MATLAB graphics is forced to go through one single thread in order to prevent inconsistencies in the graphic structures. Instead, update the graphic objects sequentially. MATLAB only updates the screen under limited circumstances, so even though the instructions might be given sequentially, the combined result of the instructions is most likely what will show up on the screen on the next screen update.
5 Comments
Walter Roberson
on 22 May 2012
Any one rectangle() object can only have one color. To use multiple colors, either use multiple rectangle objects or use patch()
If you use the structure I outlined of two rectangles in the same place representing one tank, then if you fill the background one with red and you make the green filled one progressively wider, the green will cover over the red, giving you much the look you are thinking of.
More Answers (0)
See Also
Categories
Find more on Migrate GUIDE Apps 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!