How to get the index of a selected row ListBox and pass that onto a new view

조회 수: 13 (최근 30일)
Trevor
Trevor 2013년 5월 22일
I am loading another .fig on click in a listbox, but I want to get that index that was clicked within the listbox, then pass that on to the new .fig. How would I do this? Thanks
  댓글 수: 1
Jan
Jan 2013년 5월 22일
편집: Jan 2013년 5월 22일
What does "passing an index to a new fig" exactly mean? What does "index" mean here? What is a "row listbox"? Please describe the problem more precisely by editing the question - not as comment or answer. Thanks.

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2013년 5월 22일
% Get the item selected in listbox1 of fig1:
selectedItem = get(handles.listbox1, 'value');
% Now send it to the second function
% Call fig2 and pass it selectedItem via the input argument list.
output2 = fig2(selectedItem);
  댓글 수: 1
Trevor
Trevor 2013년 5월 22일
편집: Trevor 2013년 5월 22일
I got the value, but I still cant seem to figure out how to send it to the next figure for use.
output2 = fig2(selectedItem);
Didnt seem to work. I also tried global variables and that didnt work either.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by