Azzera filtri
Azzera filtri

ListBox error - existent field

3 visualizzazioni (ultimi 30 giorni)
Adam
Adam il 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);

Risposta accettata

Sean de Wolski
Sean de Wolski il 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 Commento
Adam
Adam il 8 Feb 2012
Great, thank you. I missed that detail (handles) before uicontrol. Thank you very much.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by