MATLAB: Retrieve variables from inputdlg in a GUI

callbackguiinputdlg

Hi,
I have built a GUI where the callback of 'Project Menu' has an input dialog as below code.
The GUI also has a bushbutton which requires the values which were input in the inputdlg.
Is there any way to retrieve the values of 'Project Name' and 'Project Number' to use in the bushbutton callback?
Thanks,
Prompt={'Project Name','Project Number'};
dlg_title='Project Info';
def= {' ',' '};
num_lines = [ones(size(def')) ones(size(def'))*75];
options.Resize='on';
options.Windowstyle='modal';
options.Interpreter='tex';
Project=inputdlg(Prompt,dlg_title,num_lines,def,options);

Best Answer

  • Yasser - assuming that the user doesn't press cancel, then the project name and number can be retrieved from the cell array Project
    projectName = Project{1};
    projectNumberAsString = Project{2};