lundi 14 septembre 2015

MATLAB: How to pass data between 2 GUIs using the findobj-Function?

i am new to creating GUIs with Matlab. I have one MainGui from which i open a Subgui so that the user can click checkboxes. After clicking the okay-Button my Subgui closes and one sees the MainGui-surface again.

How can i access the clickbutton value without using getappdata and setappdata and instead doing it with findobj-function which when it works is far easier for me.

So i am in the MainGui code and i look for the Subgui with

 hGui = findobj('Tag','Subgui');

where 'Subgui' is the value of the Tag property of the SubGUI. Handles visibility is on for both!!

    % get control handles for this GUI
    handlesSubgui = guidata(hGui);

    % now read the data from the checkbox
    checkValue = get(handlesSubgui.checkbox1,'Value');

Why doesnt it work? i set the correct Tags and handle visilility is on but i get

hGui =

     Empty matrix: 0-by-1

!?

Has anyone an idea? i would be glad to get help! Best regards, John




Aucun commentaire:

Enregistrer un commentaire