MATLAB Answers

Jason Schneider

How can I save a Simulink Parameter and load it an older version of Matlab?

Asked by Jason Schneider
on 19 Jul 2013

I am attempting to open a large structure .mat file in R2011a that was created in in R2012b. The structure contains Simulink Parameters, and they are missing when I load the file into the workspace.

I have subsequently tried to save (R2012b) and load (R2011a) individual Simulink Parameters to no avail.

My attempts so far...

x = Simulink.Parameter; save('x')

y = Simulink.Parameter; save('y','y','-v7.3')

z = Simulink.Parameter; save('z','z','-v7')

q = Simulink.Parameter; save('q','q','-v6')

(The version #'s I found in doc save) When I open R2011a and select the .mat files q,x and z their preview values are displayed in the current folder window as a 0x0 Simulink.Parameter. y.mat displays nothing and in the Matlab issues a warning in the command window:

'Warning: Cannot load instance of class Simulink.Parameter. Class Simulink.Parameter has been updated and is not compatible with the old definition.'

the results of loading the other three .mat files are as folllows...

load x,z or q -> ' Warning: Variable 'x,z or q' originally saved as a Simulink.Parameter cannot be instantiated as an object and will be read in as a uint32' Workspace value = [3707764736;2;1;1;1;1]

Can anyone help me with this issue?


1 Answer

Answer by Akshata M
on 19 Jul 2013
 Accepted answer

Simulink parameters saved in 2012b version cannot be used in the lower versions of matlab as the architecture of the mat file is different. you need to make them into an m script and again load them in 2011a

  1 Comment

Thank you! This seems to work. I have used the Simulink.saveVars function to save the Simulink.Parameters in R2012b workspace to m-files. One thing to note is that the 'Min' and 'Max' values in R2012b Simulink.Parameters is default set to [ ]. R2011a sets them default to '-Inf' and 'Inf' and if they are empty throws an error saying the parameter must be scalar.

Should be easy to work around. Just thought I'd post the issue on here.

Thanks again.

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!