<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256864</link>
    <title>MATLAB Central Newsreader - Plot workspace data with GUI</title>
    <description>Feed for thread: Plot workspace data with GUI</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by 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>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Fri, 24 Jul 2009 10:10:19 -0400</pubDate>
      <title>Plot workspace data with GUI</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256864#667880</link>
      <author>Giacomo </author>
      <description>Hello all,&lt;br&gt;
in my Simulink model I have a &quot;To Workspace&quot; block called &quot;Test_Data&quot; where I store the simulation data to the base workspace. I wish that, once the simulation is finished and the data are registered into the workspace, clicking on a button on my GUI it pop-up the graph of &quot;Test_Data&quot; with time. It seems so easy but its two days I cannot solve it, matlab keeps giving me errors like &quot;Undefined function or variable 'Test_Data'.&lt;br&gt;
The code for the Plot button callback is:&lt;br&gt;
&lt;br&gt;
function plot_button_Callback(hObject, eventdata, handles)&lt;br&gt;
axes(handles.axes1)&lt;br&gt;
options = simset('SrcWorkspace','base');&lt;br&gt;
plot(Test_Data, 'DisplayName', 'Test_Data', 'YDataSource', 'Test_Data');&lt;br&gt;
&lt;br&gt;
Can someone help me out solving this? Thank you in advance^^&lt;br&gt;
&lt;br&gt;
Giacomo</description>
    </item>
    <item>
      <pubDate>Fri, 24 Jul 2009 11:25:10 -0400</pubDate>
      <title>Re: Plot workspace data with GUI</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256864#667892</link>
      <author>Bill August</author>
      <description>&amp;gt; Hello all,&lt;br&gt;
&amp;gt; in my Simulink model I have a &quot;To Workspace&quot; block&lt;br&gt;
&amp;gt; called &quot;Test_Data&quot; where I store the simulation data&lt;br&gt;
&amp;gt; to the base workspace. I wish that, once the&lt;br&gt;
&amp;gt; simulation is finished and the data are registered&lt;br&gt;
&amp;gt; into the workspace, clicking on a button on my GUI it&lt;br&gt;
&amp;gt; pop-up the graph of &quot;Test_Data&quot; with time. It seems&lt;br&gt;
&amp;gt; so easy but its two days I cannot solve it, matlab&lt;br&gt;
&amp;gt; keeps giving me errors like &quot;Undefined function or&lt;br&gt;
&amp;gt; variable 'Test_Data'.&lt;br&gt;
&amp;gt; The code for the Plot button callback is:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; function plot_button_Callback(hObject, eventdata,&lt;br&gt;
&amp;gt; handles)&lt;br&gt;
&amp;gt; axes(handles.axes1)&lt;br&gt;
&amp;gt; options = simset('SrcWorkspace','base');&lt;br&gt;
&amp;gt; plot(Test_Data, 'DisplayName', 'Test_Data',&lt;br&gt;
&amp;gt; 'YDataSource', 'Test_Data');&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Can someone help me out solving this? Thank you in&lt;br&gt;
&amp;gt; advance^^&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Giacomo&lt;br&gt;
Hi Giacomo,&lt;br&gt;
As you function &quot;plot_button_Callback&quot; and workspace is not in the same stack. You need to either capture the data from the workspace to your function, or execute you plot function in the workspace.&lt;br&gt;
The direct way is to use &quot;evalin&quot;&lt;br&gt;
&lt;br&gt;
If you want to capture the data from the workspace,&lt;br&gt;
Test_Data = evalin('base', 'Test_Data') ; &lt;br&gt;
plot(Test_Data, 'DisplayName', 'Test_Data', 'YDataSource', 'Test_Data');&lt;br&gt;
&lt;br&gt;
Or you can execute your plot function in the workspace,&lt;br&gt;
evalin('plot(Test_Data, ''DisplayName'', ''Test_Data'', ''YDataSource'', ''Test_Data'');') ;&lt;br&gt;
&lt;br&gt;
These solutions are not the best way to organize the data, you may try to save the data to your local handle. i.e. &quot;UserData&quot; of the GUI handle.</description>
    </item>
    <item>
      <pubDate>Sun, 26 Jul 2009 07:16:05 -0400</pubDate>
      <title>Re: Plot workspace data with GUI</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256864#668178</link>
      <author>Giacomo </author>
      <description>Bill August &amp;lt;hui.song@beds.ac.uk&amp;gt; wrote in message &amp;lt;17858889.32139.1248434741394.JavaMail.jakarta@nitrogen.mathforum.org&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Hello all,&lt;br&gt;
&amp;gt; &amp;gt; in my Simulink model I have a &quot;To Workspace&quot; block&lt;br&gt;
&amp;gt; &amp;gt; called &quot;Test_Data&quot; where I store the simulation data&lt;br&gt;
&amp;gt; &amp;gt; to the base workspace. I wish that, once the&lt;br&gt;
&amp;gt; &amp;gt; simulation is finished and the data are registered&lt;br&gt;
&amp;gt; &amp;gt; into the workspace, clicking on a button on my GUI it&lt;br&gt;
&amp;gt; &amp;gt; pop-up the graph of &quot;Test_Data&quot; with time. It seems&lt;br&gt;
&amp;gt; &amp;gt; so easy but its two days I cannot solve it, matlab&lt;br&gt;
&amp;gt; &amp;gt; keeps giving me errors like &quot;Undefined function or&lt;br&gt;
&amp;gt; &amp;gt; variable 'Test_Data'.&lt;br&gt;
&amp;gt; &amp;gt; The code for the Plot button callback is:&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; function plot_button_Callback(hObject, eventdata,&lt;br&gt;
&amp;gt; &amp;gt; handles)&lt;br&gt;
&amp;gt; &amp;gt; axes(handles.axes1)&lt;br&gt;
&amp;gt; &amp;gt; options = simset('SrcWorkspace','base');&lt;br&gt;
&amp;gt; &amp;gt; plot(Test_Data, 'DisplayName', 'Test_Data',&lt;br&gt;
&amp;gt; &amp;gt; 'YDataSource', 'Test_Data');&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Can someone help me out solving this? Thank you in&lt;br&gt;
&amp;gt; &amp;gt; advance^^&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Giacomo&lt;br&gt;
&amp;gt; Hi Giacomo,&lt;br&gt;
&amp;gt; As you function &quot;plot_button_Callback&quot; and workspace is not in the same stack. You need to either capture the data from the workspace to your function, or execute you plot function in the workspace.&lt;br&gt;
&amp;gt; The direct way is to use &quot;evalin&quot;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If you want to capture the data from the workspace,&lt;br&gt;
&amp;gt; Test_Data = evalin('base', 'Test_Data') ; &lt;br&gt;
&amp;gt; plot(Test_Data, 'DisplayName', 'Test_Data', 'YDataSource', 'Test_Data');&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Or you can execute your plot function in the workspace,&lt;br&gt;
&amp;gt; evalin('plot(Test_Data, ''DisplayName'', ''Test_Data'', ''YDataSource'', ''Test_Data'');') ;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; These solutions are not the best way to organize the data, you may try to save the data to your local handle. i.e. &quot;UserData&quot; of the GUI handle.&lt;br&gt;
&lt;br&gt;
Thank you Bill, it solves my problem :)</description>
    </item>
  </channel>
</rss>

