uipanels list box problems
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
sir,can I know why the list of images cannot be listing in my gui after built the coding?here is the code
window=figure( 'Units', 'pixel' ,...
'Position', [320,180,650,500] ,...
'Resize', 'on' ,...
'Color', [.7,.7,.7] ,...
'NumberTitle', 'off' ,...
'MenuBar', 'none' ,...
'Name', 'Pre-Processing Process');
headpanel = uipanel('Parent',window,'FontSize',15,...
'Title','Main', 'TitlePosition','lefttop',...
'BackgroundColor',[.8,.8,.8] ,...
'FontWeight','bold',...
'Position',[.22 0.14 .45 .65]);
leftpanel=uipanel('Parent',window,'BackgroundColor',[.8,.8,.8],...
'Position',[.04 .29 .15 .5]);
axes1= axes( 'Parent',headpanel,...
'Units','normalized', ...
'Position',[0.01 0.01 2 2]);
set(axes1, ...
'Visible', 'on', ...
'Units', 'pixels');
sButton = uicontrol(window,'String','Select Image Folder',...
'CallBack', 'folder=uigetdir(''C:\Users\s'',''Select Image Folder'');',...
'Position',[55 620 190 25]);
'if folder ~= 0,';...
% Assign the value if they didn't click cancel.
'handles.ImageFolder = folder;';...
'handles = LoadImageList(handles)';...
'guidata(hObject, handles)';...
'else';...
'msgbox(''No folder specified as input for function LoadImageList.'', ''select folder'',''modal'');';...
'end,';...
hDeplb = uicontrol(leftpanel,'Style','listbox','Units','normalized',...
'String',{'Select Image'},...
'Position',[.01 .0 1 1],'BackgroundColor','white','FontSize',9);
'varargout{1} = handles.output;';...
'handles.output= hObject;';...
'guidata(hObject, handles);';...
ListOfImageNames = {};
' folder = handles.ImageFolder';...
'if ~isempty(handles.ImageFolder) ';...
'if exist(folder,''dir'') == false';...
'msgbox([''Folder '' folder does not exist.''])';...
'end';
' else';
'msgbox(''No folder specified as input for function LoadImageList.'');';...
'end';
0 comentarios
Respuestas (1)
Image Analyst
el 25 de Ag. de 2012
Probably because the syntax is just so totally mangled. You should really read the Getting started section of the help. You don't need to use ... at the end of every line. You only need to use it if you have a really long line of code - a single line of code - that you want to split over 2 or more lines for readability purposes. Second, your code looks like some kind of weird hybrid of GUIDE (because I can see the "handles" structure" and creating your own controls via code (uipanel, uicontrol, etc.) Plus a huge portion of the lines of code are enclosed within apostrophes for some unknown reason. Who told you to do that? I don't know what else to say except that you need to clean it up a lot. Watch Doug Hull's video tutorials - that might help.
17 comentarios
Image Analyst
el 1 de Oct. de 2012
Inside your function LoadImageList(handles), you need to do something like
selectedFiles = uipickfiles()
set(handles.listbox, 'String', selectedFiles);
Ver también
Categorías
Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!