Getting matlab timer to update matlab GUIDE gui?
Date : March 29 2020, 07:55 AM
it fixes the issue You can NOT put a watch on a variable. There is no callback for that. However, both FOO and BAR are being updated by either:
|
MATLAB GUIDE gui listbox intermittently disappears with seemingly obsolete error
Tag : matlab , By : n1ckless_id
Date : March 29 2020, 07:55 AM
This might help you This is a known programming-error and it has nothing to do with race condition! This is how it should work:
|
How can I create a matlab multi-line edit box in Guide?
Date : March 29 2020, 07:55 AM
it fixes the issue Take a look at the documentation for the properties of uicontrols. You can set the Max and Min properties of an edit box. I know it seems crazy, but if Max - Min > 1, the edit box will accept multiline input; if Max - Min <= 1, it is single line only. Otherwise, the Max and Min properties have no effect on edit box controls. Another option would be to have separate input methods for the name, description and other stuff that you want your users to enter via the GUI. Depending on your application, that might make for a cleaner GUI design.
|
How to link listbox and radiobutton in matlab guide?
Date : March 29 2020, 07:55 AM
it should still fix some issue From your description, I take it that you have a GUI with a listbox and a radiobutton group, and you want to update the selected option in the radiobutton group as the listbox selection is changed. You need a callback function, that executes each time the listbox selection changes. If you created your GUI with Guide (the MATLAB GUI creating tool) it will most likely have already created this function for you. It will look something like: % --- Executes on selection change in myListBox.
function myListBox_Callback(hObject, eventdata, handles)
contents = get(hObject,'String') % returns listbox contents as cell array
selection = contents{get(hObject,'Value')} % returns selected item from listbox
% <- code here to decide which radiobutton to select ->
set(handles.targetRadiobuttonHandle,'Value',1)
|
Matlab guide: Adding / deleting items from listbox
Date : March 29 2020, 07:55 AM
Hope this helps The simpliest way to remove the "empty" entries is update the listbox string with the remainig items. There are three possibilities: % --- Executes on button press in btnDeleteLabel.
function btnDeleteLabel_Callback(hObject, eventdata, handles)
% hObject handle to btnDeleteLabel (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
selectedId = get(handles.listbox_labels, 'Value') % get id of selectedLabelName
existingItems = get(handles.listbox_labels, 'String') % get current listbox list
%
% It is not necessary
%
% existingItems{selectedId} = [] % delete the id
% Identify the items: if in the list only one ites has been added the
% returned list is a char array
if(class(existingItems) == 'char')
upd_list=''
set(handles.listbox_labels, 'String', upd_list)
else
% If the returned list is a cell array there are three cases
n_items=length(existingItems)
if(selectedId == 1)
% The first element has been selected
upd_list={existingItems{2:end}}
elseif(selectedId == n_items)
% The last element has been selected
upd_list={existingItems{1:end-1}}
% Set the "Value" property to the previous element
set(handles.listbox_labels, 'Value', selectedId-1)
else
% And element in the list has been selected
upd_list={existingItems{1:selectedId-1} existingItems{selectedId+1:end}}
end
end
% Update the list
set(handles.listbox_labels, 'String', upd_list) % restore cropped version of label list
% Disable the delete pushbutton if there are no more items
existingItems = get(handles.listbox_labels, 'String')
if(isempty(existingItems))
handles.btnDeleteLabel.Enable='off'
end
|