title: Creating a GUI Listbox in matlab to load saved figures
body: <p>I want to add a Listbox to my exsisting Matlab code. I want this listbox on the second tab of my code where the graph is plotted. I want the listbox to be populated with .bmp saved plots in the current folder. I have little experience with MATLAB gui and I am having trouble even displaying the list box.</p>
  
  <p>Here is my current code</p>
  
  <pre><code> function PizanoGUI()
  x=linspace(-2,2,100);
  power=1;
  y=x.^power;
  ctrl_fh = figure; 
  
  hPwr = uicontrol('Style','edit','Parent',... 
                       ctrl_fh,...
                       'Position',[45 100 100 20],...
                       'String',num2str(power),...
                       'CallBack',@pwrHandler);
  
  hButton = uicontrol('Style','pushbutton','Parent',ctrl_fh,...  
                      'Position',[45 150 100 20],...
                      'String','Reset','Callback',@reset); 
  
  hButton = uicontrol('Style','pushbutton','Parent',ctrl_fh,...  
                      'Position',[45 50 100 20],...
                      'String','EXIT','Callback',@close_Callback);                 
  
  htext=uicontrol('Style', 'text',... 
  'String', 'Welcome! Please Enter any value p to view the graph of y=x^p then press enter', ... 
  'Position',[35,250,500,90], ... 
  'FontSize',20);
  
  function close_Callback(hObject, eventdata, handles)
  
  close all;
  end
  
  function reset(source,event,handles,varargin) 
      fprintf('resetting...\n');
      power=1;
      set(hPwr,'String',num2str(power));
      y=x.^power;
      close(gcf);
      compute_and_draw_plot();
  end
  
  function pwrHandler(source,event,handles,varargin)     
      power=str2num(get(hPwr,'string'));
      fprintf('Setting power to %s\n',get(hPwr,'string'));
      close(gcf);
      compute_and_draw_plot();
  end
  
  
  function compute_and_draw_plot()
      plot_fh = figure;
      y=x.^power;
      figure(plot_fh); plot(x,y)
      xlabel('X axis') 
      ylabel('Y axis') 
      str = sprintf('Plot of Y=X^%d',power);
      title(str);
  
      hButton = uicontrol('Style','pushbutton','Parent',plot_fh,...  
                      'Position',[80 395 100 20],...
                      'String','Previous','Callback',@pushbutton1_Callback);
  
  
  
  function pushbutton1_Callback(source, eventdata, handles)
      close(gcf);
      PizanoGUI();
  end
  
  
   filename = inputdlg('Save figure as...');
  
   extensions = {'fig','bmp'};
  
   for k = 1:length(extensions)
  
  saveas(gcf, filename{:}, extensions{k})
  
  set(gcf,'PaperPositionMode','auto')
  
  end
  end
  end
  </code></pre>