title: How to insert a structure into a function in matlab
body: <p>I am writing a matlab function as :</p>
  
  <pre><code>function [resultNorm]= explorEffort (n, loop, step)
  ...
  Somelines
  ...
  M=bench(a,b).Y ;
  end
  </code></pre>
  
  <p>but it seems that the matlab compiler doesn't let me use a structure in the function, the error is:</p>
  
  <pre><code>Error: File: explorEffort.m Line: 20 Column: 15
  Functions cannot be indexed using {} or . indexing.
  </code></pre>
  
  <p>P.S: the bench definition</p>
  
  <pre><code>bench = 
  
  24x5 struct array with fields:
  
  application
  dataset
  mica
  micaNorm
  DB
  Y
  </code></pre>
  
  <p>Could anyone mention how am I gonna be able to fix that?</p>