How can i get image from other GUI in a project - i can not use global variable

4 views (last 30 days)
Hi everybody
I have a project and i will summerize :
at first i will run a GUI1 with a button Camera - then another (GUI2 - GUI of Camera) will appear for me to find all camera that connect to my computer - then i will choose one and configurate all properties that i want
and finaly i comeback GUI1 and press 'Take Photo' button to capture a new image and display in an axes on the same GUi - GUI1
But i dont know what to do - i find some way to do but i did not sucess ( i use a gobal variable named 'camojb' in GUi2 ( GUi of Camera) and i used this variable again in GUI 1 )
Pls Help me
many thanks!

Answers (1)

Kevin Holst
Kevin Holst on 25 Apr 2012
I'm assuming that the problem is you're unable to use the information you acquired from GUI2. Globals may work, but they're not really recommended except in special circumstances. I'd suggest using setappdata and getappdata. If you're passing the handle of your GUI1 figure it'd be something like:
and then on the GUI1 take picture callback:
camobj = getappdata(hgui1,'camobj');
If you're not passing the handle for GUI1 into GUI2 then I'd just suggest using the same code, just swapping 0 for hgui1, that puts it in the root.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by