Struggling to get data into my popup menus to then select desired inputs to generate an output.
Here is my code… I have a push button that creates a MEX file and converts sie files to mat and generates a structure. Then I want three popup menus to select three channels to then solve. How do I populate my generated data1.ChannelName in the popup menus and then input those selections into variables?
% --- Executes on selection change in lat1.
function lat1_Callback(hObject, eventdata, handles)% hObject handle to lat1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
items = get(hObject, 'String', data1.ChannelName);index_selected = get(hObject, 'Value');item_selected = items{index_selected};display(item_selected);% Hints: contents = cellstr(get(hObject,'String')) returns lat1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from lat1
% --- Executes during object creation, after setting all properties.
function lat1_CreateFcn(hObject, eventdata, handles)% hObject handle to lat1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
set(hObject,'String',data1.ChannelName);% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end
Best Answer