Filter löschen
Filter löschen

ListBox error - existent field

3 Ansichten (letzte 30 Tage)
Adam
Adam am 8 Feb. 2012
Hi I have a problem, I wanted to let the selected folder names DICOM file appears in the listbox. But Hals me an error:
??? References to non-existent field 'ListBox'.
Error in ==> load at 35
set (handles.ListBox, 'String', char (dfiles.name), 'value', 1);
Does anybody know how to do it? Thank you very much.
h1=figure;
ListBox=uicontrol('Units','Normalized','Position',[0.01 0.1 0.1 0.15],...
'Style','List');
P=fileparts(mfilename('fullpath'));
nfolder=uigetdir(P,'cokoliv');
handles.dfolder=nfolder;
handles.dfolder=nfolder;
dfiles=dir(handles.dfolder);
dfiles=dfiles(3:end);
set(handles.ListBox,'String',char(dfiles.name),'value',1);
fname=get(handles.ListBox,'String');
fname=fname(get(handles.ListBox,'value'),:);
img=dicomread([dfolder '\' fname]);
imagesc(img);

Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 8 Feb. 2012
handles =
dfolder: 'H:\Documents\MATLAB'
It does not have a field ListBox. You can either make listbox a field
handles.ListBox = uicontrol(...
Or call get/set directly with ListBox
get(ListBox,'...
  1 Kommentar
Adam
Adam am 8 Feb. 2012
Great, thank you. I missed that detail (handles) before uicontrol. Thank you very much.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by