Info
This question is closed. Reopen it to edit or answer.
Help me on this Code
2 views (last 30 days)
Show older comments
*
function listbox1 _Callback(hObject, eventdata, handles)
index_selected = get(hObject,'Value');
list = get(hObject,'String');
item_selected = list{index_selected}; % Convert from cell array % to strin
disp(item_selected);
function listbox2 _Callback(hObject, eventdata, handles)
index_selected = get(hObject,'Value');
list = get(hObject,'String');
item_selected2 = list{index_selected};
disp(item_selected2);
function OK_PUSHBUTTON _Callback(hObject, eventdata, handles)
function itemFromColumnC = GetColumnC(handles, textdata);
itemFromColumnC = []; % Initialize to null
% Get the item number that they selected.
selected1 = get(handles.item_selected1, 'value');
selected2 = get(handles.item_selected2, 'value');
% Get the contents items1 = get(handles.item_selected2, 'String');
items2 = get(handles.item_selected2, 'String'); % Get the selected item
selectedItem1 = items1{selected1};
selectedItem2 = items2{selected2};
% Now compare
if selected1 == selected2
itemFromColumnC = textdata{selected1, 3};
end message = sprintf('%s',itemFromColumnC);
uiwait(msgbox(message));
For Example:
Listbox1 input=" PAss"
Listbox2 input=" Fail"
Grade Output =" D Grade"
(See the 7th row in xls sheet)
Answers (1)
Image Analyst
on 24 Sep 2013
I think you want to use strcmpi() instead of ==
if strcmpi(selectedItem1, selectedItem2)
% They match
else
% they don't match
end
1 Comment
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!