Hello. I am trying to write a script that, when executed, allows the user to click on a button in a dialog box and select a directory. Furthermore, I want to store the directory path as a string. The problem I have is that the 'callback' I am using is to an in-built function and the 'help' I have looked at seems to be for user-created functions.
For example: https://uk.mathworks.com/help/matlab/creating_guis/share-data-among-callbacks.html#bt9p4qp.
I believe the advice on 'guidata' and 'guihandles' is for cases where you can write 'guihandles' into a separate section of code where the function is defined, which I don't have. I saw the same thing in the section for storing data in UserData.
Here is what I have so far:
% Setting up a dialog boxbox = dialog('WindowStyle','normal','Name','My Dialog');% Setting up 'uicontrol'uicontrol(box,'Style','pushbutton','String','Click here','Position',[50 50 50 50],'Callback',@(src,event)uigetdir('C:\','Pick a folder:'));
So, how can I retrieve the directory path from the callback of the 'uigetdir' function? Any solutions or links to documentation that already has the answer would be greatly appreciated.