Question

I just created a GUI using guide in MATLAB for a small project I'm working on. I have amongst other things two text fields for from and to dates. Now I'd like to get rid of them and use a Java date select tool. Of course this is not possible using guide so I need to add them manually. I've managed to get them to show up by putting this code into my Opening_Fcn,

uicomponent(handles, 'style','com.jidesoft.combobox.DateChooserPanel','tag','til2');

using UICOMPONENT.

But even though it shows up I can't access the date select's attributes, for example

get(handles.til2)

returns

??? Reference to non-existent field 'til2'.

How can I fix this?

Was it helpful?

Solution

Unless you edit the saved GUI figure, the basic handles structure will not include your new component by default.

One way to access you component is to store the handle via guidata, by adding the following to your opening function:

handles.til2 = uicomponent(handles, 'style','com.jidesoft.combobox.DateChooserPanel','tag','til2');
guidata(hObject,handles)

Functions that need to access the handle need the line

handles = guidata(hObject) 

to return the full handles structure that includes the filed til2

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top