MATLAB GUI 中未显示弹出菜单上最后一项的值

Last item's value on popup menu not being displayed in MATLAB GUI

在下面的代码中,当用户按下按钮时,弹出菜单中的 selected 值被读取并显示在命令 window 中。选项为 "mild"、"moderate" 和 "severe"。当我 select 前两个选项中的任何一个时,我得到 selectedSeverity = mild (or moderate)。然而,当我 select 严重时,我得到这个 selectedSeverity = [1x7 char]。我不确定我做错了什么或我错过了什么。任何帮助表示赞赏。

% --- Executes on button press in addNotesButton.
function addNotesButton_Callback(hObject, eventdata, handles)
% hObject    handle to addNotesButton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

contents = get(handles.artSevSel, 'String'); 
selectedSeverity = contents(get(handles.artSevSel, 'Value'))


return

根据@Benoit_11的建议。我没有阅读单元格数组的内容。最后一行应该用花括号括起来,以便函数访问单元格的内容,而不仅仅是数组。