Borrar filtros
Borrar filtros

ListBox error - existent field

3 visualizaciones (últimos 30 días)
Adam
Adam el 8 de Feb. de 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);

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by