<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167552</link>
    <title>MATLAB Central Newsreader - gui problem</title>
    <description>Feed for thread: gui problem</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2008 by The MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>The MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 14 Apr 2008 22:26:02 -0400</pubDate>
      <title>gui problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167552#426599</link>
      <author>Adam Bright</author>
      <description>Hi I've been trying to make a listbox which contains the&lt;br&gt;
information from an array; this will then be used as the&lt;br&gt;
start point for the graoh which i'm producing.At the moment&lt;br&gt;
the script i have is using the whole range which is in the&lt;br&gt;
array and is producing the graph ok. However now that i'm&lt;br&gt;
trying to make the listbox work, it says "Undefined function&lt;br&gt;
or variable 'time'"&lt;br&gt;
&lt;br&gt;
However, the time array does exist otherwise it would be&lt;br&gt;
impossible for the graph to show.When I type the array&lt;br&gt;
'time' in the workspace, it says the same thing,so i dont&lt;br&gt;
understand   how its possible that the array is being used&lt;br&gt;
to perform the graph but the array is showing to produce the&lt;br&gt;
listbox.&lt;br&gt;
&lt;br&gt;
my code is the following:&lt;br&gt;
function varargout = gui(varargin)&lt;br&gt;
% GUI M-file for gui.fig&lt;br&gt;
%      GUI, by itself, creates a new GUI or raises the existing&lt;br&gt;
%      singleton*.&lt;br&gt;
%&lt;br&gt;
%      H = GUI returns the handle to a new GUI or the handle to&lt;br&gt;
%      the existing singleton*.&lt;br&gt;
%&lt;br&gt;
%      GUI('CALLBACK',hObject,eventData,handles,...) calls&lt;br&gt;
the local&lt;br&gt;
%      function named CALLBACK in GUI.M with the given input&lt;br&gt;
arguments.&lt;br&gt;
%&lt;br&gt;
%      GUI('Property','Value',...) creates a new GUI or&lt;br&gt;
raises the&lt;br&gt;
%      existing singleton*.  Starting from the left,&lt;br&gt;
property value pairs are&lt;br&gt;
%      applied to the GUI before gui_OpeningFunction gets&lt;br&gt;
called.  An&lt;br&gt;
%      unrecognized property name or invalid value makes&lt;br&gt;
property application&lt;br&gt;
%      stop.  All inputs are passed to gui_OpeningFcn via&lt;br&gt;
varargin.&lt;br&gt;
%&lt;br&gt;
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI&lt;br&gt;
allows only one&lt;br&gt;
%      instance to run (singleton)".&lt;br&gt;
%&lt;br&gt;
% See also: GUIDE, GUIDATA, GUIHANDLES&lt;br&gt;
&lt;br&gt;
% Edit the above text to modify the response to help gui&lt;br&gt;
&lt;br&gt;
% Last Modified by GUIDE v2.5 31-Mar-2008 12:06:04&lt;br&gt;
&lt;br&gt;
% Begin initialization code - DO NOT EDIT&lt;br&gt;
gui_Singleton = 1;&lt;br&gt;
gui_State = struct('gui_Name',       mfilename, ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'gui_Singleton',  gui_Singleton, ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'gui_OpeningFcn', @gui_OpeningFcn, ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'gui_OutputFcn',  @gui_OutputFcn, ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'gui_LayoutFcn',  [] , ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'gui_Callback',   []);&lt;br&gt;
if nargin &amp;&amp; ischar(varargin{1})&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;gui_State.gui_Callback = str2func(varargin{1});&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
if nargout&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[varargout{1:nargout}] = gui_mainfcn(gui_State,&lt;br&gt;
varargin{:});&lt;br&gt;
else&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;gui_mainfcn(gui_State, varargin{:});&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
% End initialization code - DO NOT EDIT&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
% --- Executes just before gui is made visible.&lt;br&gt;
function gui_OpeningFcn(hObject, eventdata, handles, varargin)&lt;br&gt;
% This function has no output args, see OutputFcn.&lt;br&gt;
% hObject    handle to figure&lt;br&gt;
% eventdata  reserved - to be defined in a future version of&lt;br&gt;
MATLAB&lt;br&gt;
% handles    structure with handles and user data (see GUIDATA)&lt;br&gt;
% varargin   command line arguments to gui (see VARARGIN)&lt;br&gt;
%Assinging Variables&lt;br&gt;
[time,number,pressure,raininput] =&lt;br&gt;
textread('staticvirginia.txt','%s %d %f&lt;br&gt;
%f','delimiter',',','headerlines',4);&lt;br&gt;
% Choose default command line output for gui&lt;br&gt;
handles.output = hObject;&lt;br&gt;
set(hObject,'toolbar','figure');&lt;br&gt;
% Update handles structure&lt;br&gt;
guidata(hObject, handles);&lt;br&gt;
&lt;br&gt;
% UIWAIT makes gui wait for user response (see UIRESUME)&lt;br&gt;
% uiwait(handles.figure1);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
% --- Outputs from this function are returned to the command&lt;br&gt;
line.&lt;br&gt;
function varargout = gui_OutputFcn(hObject, eventdata, handles) &lt;br&gt;
% varargout  cell array for returning output args (see&lt;br&gt;
VARARGOUT);&lt;br&gt;
% hObject    handle to figure&lt;br&gt;
% eventdata  reserved - to be defined in a future version of&lt;br&gt;
MATLAB&lt;br&gt;
% handles    structure with handles and user data (see GUIDATA)&lt;br&gt;
&lt;br&gt;
% Get default command line output from handles structure&lt;br&gt;
varargout{1} = handles.output;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
% --- Executes on button press in Graph1.&lt;br&gt;
function Graph1_Callback(hObject, eventdata, handles)&lt;br&gt;
% hObject    handle to Graph1 (see GCBO)&lt;br&gt;
% eventdata  reserved - to be defined in a future version of&lt;br&gt;
MATLAB&lt;br&gt;
% handles    structure with handles and user data (see GUIDATA)&lt;br&gt;
axes(handles.axes1)&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
%If statement to convert pressure into volume&lt;br&gt;
case1 = (pressure &amp;lt; 995.7);&lt;br&gt;
case2 = (pressure &amp;gt;= 995.7 &amp; pressure &amp;lt; 1149.2);&lt;br&gt;
case3 = (pressure &amp;gt;= 1149.2);&lt;br&gt;
volume = zeros(size(pressure));&lt;br&gt;
volume(case1) = ((pressure(case1)-442.95)*5.365);&lt;br&gt;
volume(case2) = ((pressure(case2)-749.29)*12.034);&lt;br&gt;
volume(case3) = ((pressure(case3)-934.08)*22.371);&lt;br&gt;
&lt;br&gt;
cumvol = volume;&lt;br&gt;
for i = 2:length(cumvol), if cumvol(i) &amp;lt; cumvol(i-1)&lt;br&gt;
cumvol(i) = cumvol(i-1); end, end&lt;br&gt;
&lt;br&gt;
zerovol = (cumvol - (cumvol(1,1)));&lt;br&gt;
%values = 3000 * (ones(size(zerovol)));&lt;br&gt;
runoff = zerovol / 3000; &lt;br&gt;
&lt;br&gt;
cumrain = cumsum(raininput);&lt;br&gt;
&lt;br&gt;
%5 minute rain values &lt;br&gt;
cumrain5 = cumrain(1:5:end);&lt;br&gt;
runoff5 = runoff(1:5:end);&lt;br&gt;
%Discretised values for cumrain and runoff&lt;br&gt;
&lt;br&gt;
d = 2:length(cumrain5);&lt;br&gt;
disccumrain = (cumrain5(d)) - (cumrain5(d-1));&lt;br&gt;
&lt;br&gt;
e = 2:length(runoff5);&lt;br&gt;
discrunoff = (runoff5(e)) - (runoff5(e-1));&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
%Graph Plotting Information&lt;br&gt;
timeplot = datenum(time, '"yyyy-mm-dd HH:MM:SS"');&lt;br&gt;
timeplot5 = timeplot(3:5:end);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
[AX,H1,H2] =&lt;br&gt;
plotyy(timeplot5,disccumrain,timeplot5,discrunoff,'bar'); &lt;br&gt;
set(gcf, 'color', 'white');&lt;br&gt;
set(H1,'BarWidth',0.4,...&lt;br&gt;
&amp;nbsp;&amp;nbsp;'EdgeColor',[0 0.749 0.749],...&lt;br&gt;
&amp;nbsp;&amp;nbsp;'FaceColor',[0 0.749 0.749],...&lt;br&gt;
&amp;nbsp;&amp;nbsp;'LineStyle','--') &lt;br&gt;
set(H2,'BarWidth',0.4,...&lt;br&gt;
&amp;nbsp;&amp;nbsp;'EdgeColor',[0.6824 0.4667 0],...&lt;br&gt;
&amp;nbsp;&amp;nbsp;'FaceColor',[0.6824 0.4667 0],...&lt;br&gt;
&amp;nbsp;&amp;nbsp;'LineStyle',':') &lt;br&gt;
set(AX(2),'YLim',[0 1])&lt;br&gt;
set(AX(1),'YLim',[0 1])&lt;br&gt;
set(AX(1),'YTick',[0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1])&lt;br&gt;
set(AX(2),'YTick',[0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1])&lt;br&gt;
set(get(AX(1),'Ylabel'),'String','Rainfall (mm)') &lt;br&gt;
set(get(AX(2),'Ylabel'),'String','Surface Runoff (mm)') &lt;br&gt;
title('Surface Runoff from green roof with rainfall&lt;br&gt;
comparison');&lt;br&gt;
xlabel('Time');&lt;br&gt;
datetick(AX(1),'x',15)&lt;br&gt;
datetick(AX(2),'x',15)&lt;br&gt;
%datetick(AX(1),'x','dd-mmm-yyyy HH:MM:SS')&lt;br&gt;
%datetick(AX(2),'x','dd-mmm-yyyy HH:MM:SS')&lt;br&gt;
%datetick(AX(1),'x',13)&lt;br&gt;
%datetick(AX(2),'x',13)&lt;br&gt;
guidata(hObject, handles);&lt;br&gt;
&lt;br&gt;
% --- Executes on button press in Graph2.&lt;br&gt;
function Graph2_Callback(hObject, eventdata, handles)&lt;br&gt;
% hObject    handle to Graph2 (see GCBO)&lt;br&gt;
% eventdata  reserved - to be defined in a future version of&lt;br&gt;
MATLAB&lt;br&gt;
% handles    structure with handles and user data (see GUIDATA)&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
% --- Executes on button press in Graph3.&lt;br&gt;
function Graph3_Callback(hObject, eventdata, handles)&lt;br&gt;
% hObject    handle to Graph3 (see GCBO)&lt;br&gt;
% eventdata  reserved - to be defined in a future version of&lt;br&gt;
MATLAB&lt;br&gt;
% handles    structure with handles and user data (see GUIDATA)&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
% --- Executes on selection change in listbox1.&lt;br&gt;
function listbox1_Callback(hObject, eventdata, handles)&lt;br&gt;
% hObject    handle to listbox1 (see GCBO)&lt;br&gt;
% eventdata  reserved - to be defined in a future version of&lt;br&gt;
MATLAB&lt;br&gt;
% handles    structure with handles and user data (see GUIDATA)&lt;br&gt;
&lt;br&gt;
% Hints: contents = get(hObject,'String') returns listbox1&lt;br&gt;
contents as cell array&lt;br&gt;
%        contents{get(hObject,'Value')} returns selected&lt;br&gt;
item from listbox1&lt;br&gt;
&lt;br&gt;
start_date = get(handles.listbox1,'Value')&lt;br&gt;
guidata(hObject, handles);&lt;br&gt;
% --- Executes during object creation, after setting all&lt;br&gt;
properties.&lt;br&gt;
function listbox1_CreateFcn(hObject, eventdata, handles)&lt;br&gt;
% hObject    handle to listbox1 (see GCBO)&lt;br&gt;
% eventdata  reserved - to be defined in a future version of&lt;br&gt;
MATLAB&lt;br&gt;
% handles    empty - handles not created until after all&lt;br&gt;
CreateFcns called&lt;br&gt;
&lt;br&gt;
% Hint: listbox controls usually have a white background on&lt;br&gt;
Windows.&lt;br&gt;
%       See ISPC and COMPUTER.&lt;br&gt;
set(handles.listbox1,'String',time)&lt;br&gt;
if ispc &amp;&amp; isequal(get(hObject,'BackgroundColor'),&lt;br&gt;
get(0,'defaultUicontrolBackgroundColor'))&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set(hObject,'BackgroundColor','white');&lt;br&gt;
end&lt;br&gt;
guidata(hObject, handles);&lt;br&gt;
&lt;br&gt;
% --- Executes on selection change in listbox2.&lt;br&gt;
function listbox2_Callback(hObject, eventdata, handles)&lt;br&gt;
% hObject    handle to listbox2 (see GCBO)&lt;br&gt;
% eventdata  reserved - to be defined in a future version of&lt;br&gt;
MATLAB&lt;br&gt;
% handles    structure with handles and user data (see GUIDATA)&lt;br&gt;
&lt;br&gt;
% Hints: contents = get(hObject,'String') returns listbox2&lt;br&gt;
contents as cell array&lt;br&gt;
%        contents{get(hObject,'Value')} returns selected&lt;br&gt;
item from listbox2&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
end_date = get(handles.listbox2,'Value');&lt;br&gt;
% --- Executes during object creation, after setting all&lt;br&gt;
properties.&lt;br&gt;
function listbox2_CreateFcn(hObject, eventdata, handles)&lt;br&gt;
% hObject    handle to listbox2 (see GCBO)&lt;br&gt;
% eventdata  reserved - to be defined in a future version of&lt;br&gt;
MATLAB&lt;br&gt;
% handles    empty - handles not created until after all&lt;br&gt;
CreateFcns called&lt;br&gt;
&lt;br&gt;
% Hint: listbox controls usually have a white background on&lt;br&gt;
Windows.&lt;br&gt;
%       See ISPC and COMPUTER.&lt;br&gt;
&lt;br&gt;
set(handles.listbox2,'String',time)&lt;br&gt;
if ispc &amp;&amp; isequal(get(hObject,'BackgroundColor'),&lt;br&gt;
get(0,'defaultUicontrolBackgroundColor'))&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set(hObject,'BackgroundColor','white');&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
% --- Executes on button press in ClearGraph.&lt;br&gt;
function ClearGraph_Callback(hObject, eventdata, handles)&lt;br&gt;
% hObject    handle to ClearGraph (see GCBO)&lt;br&gt;
% eventdata  reserved - to be defined in a future version of&lt;br&gt;
MATLAB&lt;br&gt;
% handles    structure with handles and user data (see GUIDATA)&lt;br&gt;
cla(handles.axes1,'reset')&lt;br&gt;
guidata(hObject, handles);&lt;br&gt;
&lt;br&gt;
thankyou for your help &lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Mon, 14 Apr 2008 23:18:01 -0400</pubDate>
      <title>Re: gui problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167552#426608</link>
      <author>Phil Goddard</author>
      <description>&lt;br&gt;
The issue seems to be related to not understanding the &lt;br&gt;
significant differences between script M-files (which you &lt;br&gt;
say is working for you) and function M-files (with there &lt;br&gt;
being many functions in the GUIDE generated code you've &lt;br&gt;
posted).&lt;br&gt;
&lt;br&gt;
In short, although in the function "gui_OpeningFcn" you &lt;br&gt;
call textread to load your data, you need to store that &lt;br&gt;
data somewhere so that it can be retrieved and used in the &lt;br&gt;
function "Graph1_Callback".&lt;br&gt;
&lt;br&gt;
The easiest way for you is probably to have something like &lt;br&gt;
the line&lt;br&gt;
handles.time = time;&lt;br&gt;
immediately after your call to textread in gui_OpeningFcn.&lt;br&gt;
Then in Graph1_Callback use handles.time rather than just &lt;br&gt;
time to access the data.&lt;br&gt;
&lt;br&gt;
(The above relies on the way that the function GUIDATA &lt;br&gt;
works and also how GUIDE automatically passed the "handles" &lt;br&gt;
structure as an input to Graph1_Callback.&lt;br&gt;
You should look at those topics within the documentation to &lt;br&gt;
get a better idea of what's going on with your code.)&lt;br&gt;
&lt;br&gt;
Phil.&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Tue, 15 Apr 2008 02:52:04 -0400</pubDate>
      <title>Re: gui problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167552#426629</link>
      <author>Steven Lord</author>
      <description>&lt;br&gt;
"Adam Bright" &amp;lt;abc_services_2000@yahoo.co.uk&amp;gt; wrote in message &lt;br&gt;
news:fu0llq$iu6$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; Hi I've been trying to make a listbox which contains the&lt;br&gt;
&amp;gt; information from an array; this will then be used as the&lt;br&gt;
&amp;gt; start point for the graoh which i'm producing.At the moment&lt;br&gt;
&amp;gt; the script i have is using the whole range which is in the&lt;br&gt;
&amp;gt; array and is producing the graph ok. However now that i'm&lt;br&gt;
&amp;gt; trying to make the listbox work, it says "Undefined function&lt;br&gt;
&amp;gt; or variable 'time'"&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; However, the time array does exist otherwise it would be&lt;br&gt;
&amp;gt; impossible for the graph to show.When I type the array&lt;br&gt;
&amp;gt; 'time' in the workspace, it says the same thing,so i dont&lt;br&gt;
&amp;gt; understand   how its possible that the array is being used&lt;br&gt;
&amp;gt; to perform the graph but the array is showing to produce the&lt;br&gt;
&amp;gt; listbox.&lt;br&gt;
&lt;br&gt;
Each function has its own workspace, where variables that are created inside &lt;br&gt;
the function live until the function ends, at which point they are &lt;br&gt;
destroyed.  In your OpeningFcn:&lt;br&gt;
&lt;br&gt;
*snip*&lt;br&gt;
&lt;br&gt;
&amp;gt; % --- Executes just before gui is made visible.&lt;br&gt;
&amp;gt; function gui_OpeningFcn(hObject, eventdata, handles, varargin)&lt;br&gt;
&amp;gt; % This function has no output args, see OutputFcn.&lt;br&gt;
&amp;gt; % hObject    handle to figure&lt;br&gt;
&amp;gt; % eventdata  reserved - to be defined in a future version of&lt;br&gt;
&amp;gt; MATLAB&lt;br&gt;
&amp;gt; % handles    structure with handles and user data (see GUIDATA)&lt;br&gt;
&amp;gt; % varargin   command line arguments to gui (see VARARGIN)&lt;br&gt;
&amp;gt; %Assinging Variables&lt;br&gt;
&amp;gt; [time,number,pressure,raininput] =&lt;br&gt;
&amp;gt; textread('staticvirginia.txt','%s %d %f&lt;br&gt;
&amp;gt; %f','delimiter',',','headerlines',4);&lt;br&gt;
&lt;br&gt;
*snip*&lt;br&gt;
&lt;br&gt;
you create the variable 'time' here, and it exists until:&lt;br&gt;
&lt;br&gt;
*snip*&lt;br&gt;
&lt;br&gt;
&amp;gt; % UIWAIT makes gui wait for user response (see UIRESUME)&lt;br&gt;
&amp;gt; % uiwait(handles.figure1);&lt;br&gt;
&lt;br&gt;
the end of your OpeningFcn, at which point it Goes Away.  Later on, in your &lt;br&gt;
Graph1_Callback function:&lt;br&gt;
&lt;br&gt;
*snip*&lt;br&gt;
&lt;br&gt;
&amp;gt; %Graph Plotting Information&lt;br&gt;
&amp;gt; timeplot = datenum(time, '"yyyy-mm-dd HH:MM:SS"');&lt;br&gt;
&lt;br&gt;
you're using time before you create it in this function.&lt;br&gt;
&lt;br&gt;
There are a number of ways to share data between functions in a GUI.  Take a &lt;br&gt;
look at this page from the documentation for descriptions of the different &lt;br&gt;
methods:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://www.mathworks.com/access/helpdesk/help/techdoc/creating_guis/f13-998449.html"&gt;http://www.mathworks.com/access/helpdesk/help/techdoc/creating_guis/f13-998449.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
For more general information about functions, scripts, and workspaces, read &lt;br&gt;
this documentation page:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f7-38085.html"&gt;http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f7-38085.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Tue, 15 Apr 2008 16:08:03 -0400</pubDate>
      <title>Re: gui problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167552#426766</link>
      <author>Adam Bright</author>
      <description>Hi,thankyou for your responses,i've now used the guidata&lt;br&gt;
command to retrieve the variable but i'm now getting the&lt;br&gt;
following error: &lt;br&gt;
&lt;br&gt;
??? Error using ==&amp;gt; set&lt;br&gt;
Conversion to double from struct is not possible.&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; gui&amp;gt;listbox1_Callback at 173&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set(handles.listbox1,'String',timeplot5)&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; gui_mainfcn at 75&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;feval(varargin{:});&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; gui at 43&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;gui_mainfcn(gui_State, varargin{:});&lt;br&gt;
&lt;br&gt;
??? Error using ==&amp;gt;&lt;br&gt;
gui('listbox1_Callback',gcbo,[],guidata(gcbo))&lt;br&gt;
Error using ==&amp;gt; set&lt;br&gt;
Conversion to double from struct is not possible.&lt;br&gt;
&lt;br&gt;
??? Error while evaluating uicontrol Callback&lt;br&gt;
&lt;br&gt;
i've tried putting the datestr command in front, but it says:&lt;br&gt;
??? Error using ==&amp;gt; datestr&lt;br&gt;
Cannot convert input into specified date string.&lt;br&gt;
DATENUM failed.&lt;br&gt;
Error using ==&amp;gt; datevec&lt;br&gt;
The input to DATEVEC was not an array of strings..&lt;br&gt;
&lt;br&gt;
please can someone help me..&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Tue, 15 Apr 2008 16:29:06 -0400</pubDate>
      <title>Re: gui problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167552#426771</link>
      <author>Adam Bright</author>
      <description>Hi,thankyou for your responses,i've now used the guidata&lt;br&gt;
command to retrieve the variable but i'm now getting the&lt;br&gt;
following error: &lt;br&gt;
&lt;br&gt;
??? Error using ==&amp;gt; set&lt;br&gt;
Conversion to double from struct is not possible.&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; gui&amp;gt;listbox1_Callback at 173&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set(handles.listbox1,'String',timeplot5)&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; gui_mainfcn at 75&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;feval(varargin{:});&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; gui at 43&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;gui_mainfcn(gui_State, varargin{:});&lt;br&gt;
&lt;br&gt;
??? Error using ==&amp;gt;&lt;br&gt;
gui('listbox1_Callback',gcbo,[],guidata(gcbo))&lt;br&gt;
Error using ==&amp;gt; set&lt;br&gt;
Conversion to double from struct is not possible.&lt;br&gt;
&lt;br&gt;
??? Error while evaluating uicontrol Callback&lt;br&gt;
&lt;br&gt;
i've tried putting the datestr command in front, but it says:&lt;br&gt;
??? Error using ==&amp;gt; datestr&lt;br&gt;
Cannot convert input into specified date string.&lt;br&gt;
DATENUM failed.&lt;br&gt;
Error using ==&amp;gt; datevec&lt;br&gt;
The input to DATEVEC was not an array of strings..&lt;br&gt;
&lt;br&gt;
please can someone help me..&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Tue, 15 Apr 2008 18:22:36 -0400</pubDate>
      <title>Re: gui problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167552#426795</link>
      <author>matt dash</author>
      <description>could you post an example of what your time array looks like?&lt;br&gt;
&lt;br&gt;
(just the first few rows should be enough)&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Tue, 15 Apr 2008 22:45:04 -0400</pubDate>
      <title>Re: gui problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167552#426846</link>
      <author>Adam Bright</author>
      <description>&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'"2006-02-14 22:00:00"'&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'"2006-02-14 22:01:00"'&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'"2006-02-14 22:02:00"'&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'"2006-02-14 22:03:00"'&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'"2006-02-14 22:04:00"'&lt;br&gt;
&lt;br&gt;
thank you for your help.&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 16 Apr 2008 16:14:02 -0400</pubDate>
      <title>Re: gui problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167552#427001</link>
      <author>matt dash</author>
      <description>Sorry for the delayed response... &lt;br&gt;
&lt;br&gt;
The error message seems to be saying that either&lt;br&gt;
handles.listbox1 or timeplot5 is a structure (which means it&lt;br&gt;
has another level of variables below it, like&lt;br&gt;
handles.listbox1.anothervariable. &lt;br&gt;
&lt;br&gt;
I'm guessing it has something to do with the way you're&lt;br&gt;
using guidata to get the variable you need in the callback&lt;br&gt;
(since guidata usually returns a structure). If you still&lt;br&gt;
need help, could you maybe post an updated version of your&lt;br&gt;
code that shows how you're using guidata? (And also shows&lt;br&gt;
the full code for the function listbox1_callback that is&lt;br&gt;
giving the error)&lt;br&gt;
&lt;br&gt;
If you want a "quick fix" try putting a break point at the&lt;br&gt;
line that gives the error, then in your command window type&lt;br&gt;
handles.listbox1 and timeplot5 and see if either of them is&lt;br&gt;
a structure. (a structure will display as a list of names&lt;br&gt;
followed by colons and their value). If one of them is,&lt;br&gt;
maybe you can find where the value you need is stored and&lt;br&gt;
just rewrite your code to point to that field of the structure.&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 16 Apr 2008 16:40:21 -0400</pubDate>
      <title>Re: gui problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167552#427018</link>
      <author>Adam Bright</author>
      <description>thanks for your time,&lt;br&gt;
&lt;br&gt;
i first intially have used the gui data function just after&lt;br&gt;
the plot information.&lt;br&gt;
&lt;br&gt;
guidata(hObject, handles);&lt;br&gt;
guidata(hObject, timeplot5);&lt;br&gt;
&lt;br&gt;
immediately after this is the following:&lt;br&gt;
&lt;br&gt;
% --- Executes on selection change in listbox1.&lt;br&gt;
function listbox1_Callback(hObject, eventdata, handles)&lt;br&gt;
% hObject    handle to listbox1 (see GCBO)&lt;br&gt;
% eventdata  reserved - to be defined in a future version of&lt;br&gt;
MATLAB&lt;br&gt;
% handles    structure with handles and user data (see GUIDATA)&lt;br&gt;
&lt;br&gt;
% Hints: contents = get(hObject,'String') returns listbox1&lt;br&gt;
contents as cell array&lt;br&gt;
%        contents{get(hObject,'Value')} returns selected&lt;br&gt;
item from listbox1&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;timeplot5 = guidata(hObject);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set(handles.listbox1,'String',timeplot5)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;guidata(hObject, handles);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
% --- Executes during object creation, after setting all&lt;br&gt;
properties.&lt;br&gt;
function listbox1_CreateFcn(hObject, eventdata, handles)&lt;br&gt;
% hObject    handle to listbox1 (see GCBO)&lt;br&gt;
% eventdata  reserved - to be defined in a future version of&lt;br&gt;
MATLAB&lt;br&gt;
% handles    empty - handles not created until after all&lt;br&gt;
CreateFcns called&lt;br&gt;
&lt;br&gt;
% Hint: listbox controls usually have a white background on&lt;br&gt;
Windows.&lt;br&gt;
%       See ISPC and COMPUTER.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;start_date = get(handles.listbox1,'Value')&lt;br&gt;
if ispc &amp;&amp; isequal(get(hObject,'BackgroundColor'),&lt;br&gt;
get(0,'defaultUicontrolBackgroundColor'))&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set(hObject,'BackgroundColor','white');&lt;br&gt;
end&lt;br&gt;
guidata(hObject, handles);&lt;br&gt;
&lt;br&gt;
i've emailed you the full code if you think it will help.&lt;br&gt;
This is much appreciated.&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 16 Apr 2008 17:05:04 -0400</pubDate>
      <title>Re: gui problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167552#427028</link>
      <author>Phil Goddard</author>
      <description>&lt;br&gt;
You don't want these two lines&lt;br&gt;
&amp;gt; guidata(hObject, handles);&lt;br&gt;
&amp;gt; guidata(hObject, timeplot5);&lt;br&gt;
&lt;br&gt;
The second line is overwriting (not appending to) the first &lt;br&gt;
line, and hence the handles structure is being lost.&lt;br&gt;
Rather you want to add a field to the handles structure &lt;br&gt;
then store the new structure, i.e.&lt;br&gt;
&lt;br&gt;
handles.timeplot5 = timeplot5;&lt;br&gt;
guidata(hObject,handles);&lt;br&gt;
&lt;br&gt;
Then within the listbox1_Callback you want to get rid of &lt;br&gt;
the following line&lt;br&gt;
&amp;gt;     timeplot5 = guidata(hObject);&lt;br&gt;
&lt;br&gt;
and change the next line&lt;br&gt;
&amp;gt;     set(handles.listbox1,'String',timeplot5)&lt;br&gt;
to&lt;br&gt;
set(handles.listbox1,'String',handles.timeplot5)&lt;br&gt;
&lt;br&gt;
In this way the info stored in the handles.timeplot5 field &lt;br&gt;
(assuming they are strings) should display in to the &lt;br&gt;
listbox.&lt;br&gt;
&lt;br&gt;
Phil.&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Wed, 16 Apr 2008 17:09:46 -0400</pubDate>
      <title>Re: gui problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167552#427031</link>
      <author>matt dash</author>
      <description>OK, the problem is obvious now. &lt;br&gt;
&lt;br&gt;
Since you used GUIDE to make the gui, the guidata command&lt;br&gt;
should only be used to store the variable "handles". Calling&lt;br&gt;
the guidata command again with something like&lt;br&gt;
guidata(hObject,timeplot5) will completely overwrite your&lt;br&gt;
handles structure, which is a very bad thing. &lt;br&gt;
&lt;br&gt;
Now, when you run the callback to listbox1, the graph1&lt;br&gt;
callback hasnt necessarily run yet, and so the line:&lt;br&gt;
guidata(hObject,timeplot5) hasn't run, so guidata still&lt;br&gt;
contains the handles variable (which is a structure) since&lt;br&gt;
this is the default setting (see the line&lt;br&gt;
guidata(hObject,handles) at the end of the gui_openingfcn)&lt;br&gt;
&lt;br&gt;
so, in listbox1callback, the line timeplot5=guidata(hObject)&lt;br&gt;
is just storing the handles structure under the new name&lt;br&gt;
timeplot5. and your set line actually looks like:&lt;br&gt;
set(handles.listbox1,'string',handles) which is what is&lt;br&gt;
causing the error.&lt;br&gt;
&lt;br&gt;
How can you fix it?&lt;br&gt;
&lt;br&gt;
In general, you dont want to use guidata to try to store&lt;br&gt;
variables like that. Instead, just trust the fact that guide&lt;br&gt;
(by default) keeps the handles structure current between all&lt;br&gt;
callbacks in the gui. So the easiest way to pass a variable&lt;br&gt;
between two functions is to put it in the handles structure,&lt;br&gt;
and let guide handle the rest. To do this, simply preface&lt;br&gt;
the variable name with the word handles. instead of&lt;br&gt;
timeplot5, always write it as "handles.timeplot5" (without&lt;br&gt;
the quotes) and everying will be ok. &lt;br&gt;
&lt;br&gt;
In short, until you learn enough to figure out more elegant&lt;br&gt;
solutions, you can preface EVERY variable in a gui with&lt;br&gt;
"handles." and things will usually work out the way you want&lt;br&gt;
them to. &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
One more warning though: the fig file you sent me has the&lt;br&gt;
graph saved as part of the fig file, which means graph&lt;br&gt;
callback doesnt actually run when you load the gui. It might&lt;br&gt;
&amp;nbsp;be a better idea to just run the graph callback as part of&lt;br&gt;
the opening function (add the line &lt;br&gt;
Graph1_Callback(hObject, [], handles&lt;br&gt;
to the VERY END of the opening function)&lt;br&gt;
This will ensure that the handles.timeplot5 variable gets&lt;br&gt;
created before the user has a chance to click any callbacks&lt;br&gt;
that rely on it.&lt;br&gt;
&lt;br&gt;
Good luck!&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 17 Apr 2008 00:39:01 -0400</pubDate>
      <title>Re: gui problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167552#427131</link>
      <author>Adam Bright</author>
      <description>This is just a quick thankyou message to all thos that have&lt;br&gt;
helped. I've learnt loads in the process,my graph is'nt&lt;br&gt;
working but the listboxes are.I may well be posting a new&lt;br&gt;
thread regarding this. But thanks once again!&lt;br&gt;
</description>
    </item>
  </channel>
</rss>
