title: Matlab/Simulink: Convert Data Table (Measured) Into Lookup Table
body: <p>I have simulated a magnetic system and I have 2 input variables and 1 output variable. The result looks like this:</p>
  
  <pre><code>myData = [...
  0 0 1.1;...
  0 1 1.2;...
  0 2 1.2;...
  1 0.1 2.1;...
  1 0.9 2.2;...
  1 2.05 2.2;...   
  3 0.1 3.1;...
  3 1.2 3.2;...
  3 1.9 3.2;...    
  ];
  </code></pre>
  
  <p>Column 1 and 2 are the input values. Column 3 is the output variable:</p>
  
  <pre><code>x = myData(:,1);
  y = myData(:,2);
  z = myData(:,3);
  </code></pre>
  
  <p>I want to create a 2D lookup table in Simulink with <code>x</code> and <code>y</code> as inputs and <code>z</code> as an output. I do not get how to do this. It would be easy if the 2nd input variable would be evenly spaced like here:</p>
  
  <pre><code>x = [0 1 2];
  y = [0 1 2];
  z = [0 0 0; 1 2 3; 4 4 8]
  </code></pre>
  
  <p>In the Simulink lookup table block you would put:</p>
  
  <p><img src="https://i.stack.imgur.com/pky2h.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/a44Eb.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/Ackxr.png" alt="enter image description here"></p>
  
  <p><strong>In a nutshell:</strong>
  How do I treat my data do be able to use a lookup table in Simulink?</p>