Simulink compatibility issue between r2011a and r2011b

2 views (last 30 days)
Is there a way to revert the changes made for r2011b so that I can get back my r2011a-compatible file? Read on for details.
I created a simulation in Simulink r2011a and had it running just fine. I then ran it on a computer with MATLAB r2011b installed. This computer made changes to the file, and saved a "backup" titled filename.mdl.r2011a that should still run on computers with MATLAB r2011a. When I run this file, however, MATLAB immediately closes without throwing any errors. This is a major problem for me since all I have access to on a regular basis is r2011a and the simulation is too involved to recreate quickly.
I am surprised that the minor release would break compatibility like this.

Accepted Answer

Andreas Goser
Andreas Goser on 23 May 2012
I am also surprised by that behaviour and you shouldd definitely contact Technical Support for that.
In order to save a model compatible to an older version:
File -> Save As -> Modivfy the Save as type to the release you are using
  1 Comment
Nathan
Nathan on 23 May 2012
That seemed to work for one of the two simulations, but the other is still crashing as soon as I try to run it. This is strange considering that I changed nothing but some parameters (which I have since changed back to double check), and I am saving both files in r2011a format. I will try to submit the crash reports to Technical Support.
Thank you.

Sign in to comment.

More Answers (1)

Sebastian Castro
Sebastian Castro on 25 May 2012
The reason for these crashes has to do with how Simulink handles MATLAB Function blocks when the 'run' button is hit. C code is generated from the Simulink model and a 'modelname_sfun.mexext' file is created. Here, 'mexext' is, for example, 'mexw32' for 32-bit Windows. In addition, an 'slprj' directory with the C code and other files is created in the working directory.
The model crashes when saving as a R2011a model and trying to run it again because during the code generation step, Simulink sees that a MEX file and 'slprj' directories are already in the current folder and tries to work with these. The differences in the software architecture between R2011a and R2011b lead to the crash.
In order to flawlessly transition between versions, please ensure that you delete the 'slprj' and 'modelname_sfun.mexext' files prior to hitting the run button with a different version. MATLAB sometimes takes control of the MEX file, so you may have to type the following at the MATLAB Command Window in order to delete it:
>> clear mex
Once these auxiliary files have been removed from the working directory, you should be able to run the model with no issues from Simulink 7.7 (R2011a).

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!