<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173073</link>
    <title>MATLAB Central Newsreader - Help appending entered values to an array</title>
    <description>Feed for thread: Help appending entered values to an array</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>Wed, 23 Jul 2008 02:18:01 -0400</pubDate>
      <title>Help appending entered values to an array</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173073#444775</link>
      <author>jeremy </author>
      <description>I am a rather new user to the MATLAB world and I am having&lt;br&gt;
some difficulty figuring this out.  &lt;br&gt;
&lt;br&gt;
I have a mat-file that contains an array of 2 cols and 14&lt;br&gt;
rows.  When this mat-file is loaded, it produces a variable&lt;br&gt;
called &quot;hc_actual&quot; which is a 14x2 double.&lt;br&gt;
&lt;br&gt;
Here's what I want to do...&lt;br&gt;
&lt;br&gt;
Add code to my M-file that will allow me to enter a new X,Y&lt;br&gt;
pair at the command window prompt, append that pair to the&lt;br&gt;
first empty row in the &quot;hc_actual&quot; array, and then save the&lt;br&gt;
mat-file.  Then the M-file can continue on without&lt;br&gt;
interaction and produce all my plots, etc.  &lt;br&gt;
&lt;br&gt;
Could someone help me come up with the code that allows me&lt;br&gt;
to append the X,Y pair to the array?  &lt;br&gt;
&lt;br&gt;
Thanks!</description>
    </item>
    <item>
      <pubDate>Wed, 23 Jul 2008 03:28:02 -0400</pubDate>
      <title>Re: Help appending entered values to an array</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173073#444780</link>
      <author>Rodney Thomson</author>
      <description>&quot;jeremy &quot; &amp;lt;rower15@excite.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;g664cp$mjd$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I am a rather new user to the MATLAB world and I am having&lt;br&gt;
&amp;gt; some difficulty figuring this out.  &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have a mat-file that contains an array of 2 cols and 14&lt;br&gt;
&amp;gt; rows.  When this mat-file is loaded, it produces a variable&lt;br&gt;
&amp;gt; called &quot;hc_actual&quot; which is a 14x2 double.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Here's what I want to do...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Add code to my M-file that will allow me to enter a new X,Y&lt;br&gt;
&amp;gt; pair at the command window prompt, append that pair to the&lt;br&gt;
&amp;gt; first empty row in the &quot;hc_actual&quot; array, and then save the&lt;br&gt;
&amp;gt; mat-file.  Then the M-file can continue on without&lt;br&gt;
&amp;gt; interaction and produce all my plots, etc.  &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Could someone help me come up with the code that allows me&lt;br&gt;
&amp;gt; to append the X,Y pair to the array?  &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks!&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
You can index past the end of the array and Matlab will&lt;br&gt;
dynamically resize it for you:&lt;br&gt;
&lt;br&gt;
load hc_actual.mat&lt;br&gt;
&lt;br&gt;
hc_actual = rand([14 2]);&lt;br&gt;
&lt;br&gt;
new_value = [2.3123 4.6631];&lt;br&gt;
&lt;br&gt;
hc_actual(end+1, :) = new_value; % appends to end of&lt;br&gt;
hc_actual - now a 15x2 matrix&lt;br&gt;
&lt;br&gt;
save hc_actual&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Rod&lt;br&gt;
&lt;br&gt;
--&lt;br&gt;
&lt;a href=&quot;http://iheartmatlab.blogspot.com&quot;&gt;http://iheartmatlab.blogspot.com&lt;/a&gt;</description>
    </item>
    <item>
      <pubDate>Wed, 23 Jul 2008 18:34:04 -0400</pubDate>
      <title>Re: Help appending entered values to an array</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173073#444954</link>
      <author>jeremy </author>
      <description>Thanks for the input Rod...  Your suggestion worked on the&lt;br&gt;
first try.  &lt;br&gt;
&lt;br&gt;
Now here's a follow-up...  &lt;br&gt;
&lt;br&gt;
The first few lines of my file are as follows:</description>
    </item>
  </channel>
</rss>

