title: How to access/read class instance attributes in octave?
body: <p>Making a class similar to that one in the <a href="https://www.gnu.org/software/octave/doc/interpreter/Creating-a-Class.html" rel="nofollow">example</a> I attached arguments to the class instance like so</p>
  
  <pre><code>function t = train (m, F_z, F_b, varargin)
    ...
    t.m =     m;      % total mass of train [kg]
    t.F_z =  F_z;     % ...
    ...
    t = class (t, "train");
  </code></pre>
  
  <p>Getting the fieldnames works</p>
  
  <pre><code>&gt;&gt; t1 = train(100, 150000, 200000);
  ...
  &gt;&gt; fieldnames(t1)
  ans =
  {
    [1,1] = m
    [2,1] = F_z
    ...
  </code></pre>
  
  <p>But how do I access these? Apparently it's not</p>
  
  <pre><code>&gt;&gt; t1.m
  error: invalid index for class
  &gt;&gt; getfield(t1, 'm')
  error: invalid index for class
  error: called from
  ...
  </code></pre>
  
  <p>If I leave out the line <code>t = class (t, 'train');</code> at the end of <code>function t = train (m...</code> in <code>@train/train.m</code> these things all seem to work fine... But then its a <code>struct</code> and not a <code>class</code></p>