Inserting rows at a table in MATLAB
<p>I am trying to add rows at the end of table. For example:</p>

<pre><code>LastName = {'Smith';'Johnson';'Williams';'Jones';'Brown'};
Age = [38;43;38;40;49];
Height = [71;69;64;67;64];
Weight = [176;163;131;133;119];
BloodPressure = [124 93; 109 77; 125 83; 117 75; 122 80];
Tab=table;
s=struct;
for i=1:5
    s.name=LastName{i};
    s.age=Age(i);
    s.heigt=Height(i);
    s.weight=Weight(i);
    s.BP=BloodPressure(i);
    temp=struct2table(s);
    Tab(end+1,:)=temp;
end
</code></pre>

<p>The table is declared empty, it adds the 1st row, but in the second iteration of the for loop gives below error message:</p>

<pre><code>Subscripted assignment dimension mismatch for table variable 'name'.
</code></pre>

<p>I understand that this happens because of the variable name has more characters in the second iteration. Is there any way to implement this?</p>

<p>This is a sample code I generated to explain my problem. In my actual code, the problem is similar, but a structure type variable is being returned from a different function which I can't modify.  </p>