MATLAB: Save/load gui state with imroi objects

guiimroiloadsave state

I am current developing a gui from guide that uses imroi objects on an image that is an axes. Could someone give an example of saving and loading a previous state from guide using imroi objects so when you load, the objects are still adjustable?
Example: You have an image in an axis and an impoly object(s) that is adjustable. The goal is to be able to load the image and the impoly object(s) so you can adjust them.
Background: I am working with a neural image in which I want to create roi regions of cells. I have roughly 200 impoly objects in which I may have to adjust around the cell after an automatic cell segmentation algorithm creates the objects. I want to save the objects so if it takes a long time to fix the locations, I can load the state that I was previously working from.

Best Answer

Just use save() to save your variables to a .mat file, and use load() to recall them the next time you want to use them, like the next time you launch your app. I do it all the time - it works great.