How to store values in cell array?
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I made a GUI that allows the user to determine regions in an image by using ROI object. the ROI object return its position as a matrix. I want to save the positions in a cell array when ever the user determine region in the image.
How can I do that?
0 comentarios
Respuestas (2)
madhan ravi
el 13 de Oct. de 2018
Editada: madhan ravi
el 13 de Oct. de 2018
An example:
A = {rand(4)} %stores the matrix as a cell array if you use curly braces
you can access the elements like a normal one
A{1}(1,1) %first element is obtained
6 comentarios
Stephen23
el 15 de Oct. de 2018
Editada: Stephen23
el 16 de Oct. de 2018
@sara sar: if you want to pass data between callback function then use guidata (if you are unfortunately using GUIDE) or use nested functions (if you are happily writing your own GUI):
Note that callback functions do not return any output arguments, so there is no point in defining varargout.
If you want to return data from the GUI to the base workspace then either follow what I explained in my last comment, or if you are using GUIDE then use the OutputFcn:
Note that you can use waitfor inside the OutputFcn.
Image Analyst
el 13 de Oct. de 2018
Editada: Image Analyst
el 13 de Oct. de 2018
You don't need a cell array. See attached demo.
The best way to save the coordinates of a segmented image is as a binary image, or as boundaries (after using bwboundaries()).
You can use imwrite() to save the binary image in a .PNG disk file, or use save() to save the boundaries in a .mat file on disk if you need to.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!