title: Simulink difference between load_system and open_system
body: <p>I have a Simulink model that calls a script in the InitFcn of the Model callbacks. This script initializes a bunch of variables in the base workspace so that they can be used by the Simulink model. When using Classes, I found that using the <code>load_system</code> function will make Matlab crash and the <code>open_system</code> function will work just fine.</p>
  
  <p>Here the Class:</p>
  
  <pre><code>classdef simulinkModel
      properties
          model = '';
      end
      methods
          function obj = simulinkModel(modelName)
              obj.model = modelName;
          end
          function openModel(obj)
              % Make sure any previously open model are closed, and open the model.
              if bdIsLoaded(obj.model)
                  obj.closeModel()
              end
              %load_system(obj.model) % Matlab crash
              open_system(obj.model) % Matlab run the model correctly
          end
          function closeModel(obj)
              close_system(obj.model, 0) 
          end
          function runModel(obj)
              sim(obj.model)
          end
      end
  end
  </code></pre>
  
  <p>And in the command window:</p>
  
  <pre><code>objModel = simulinkModel('test');
  objModel.openModel
  objModel.runModel
  </code></pre>
  
  <p>So how comes it crashs with the <code>load_system</code> vs the <code>open_system</code>? Is there something that the <code>open_system</code> function do with the base workspace that the <code>load_system</code> function doesn't do?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I decided to try running simple commands outside of the class to see if the problem is elsewhere. So typing in the command window:</p>
  
  <pre><code>load_system('test')
  sim('test')
  </code></pre>
  
  <p>When executing this in the command window, Matlab will also crash. So I'm starting to wonder if the model callbacks are not executed when the <code>load_system</code> function is called.</p>