Simulink model working with 2010a gives an error in 2014b

1 Ansicht (letzte 30 Tage)
Srinath
Srinath am 26 Dez. 2014
Bearbeitet: Jason Ghidella am 30 Dez. 2014
I attach a very simple model file that has a Matlab function and a mux.
It's really the simplest model file. 3 constant inputs are muxed and sent to a Matlab function that computes a scalar output which in turn is displayed on scope.
It works with R2010a, but with R2014b i get the error... The dimensions are being set to 1. This is not valid because the total number of input and output elements are not the same.. I can't figure out why something that worked in the past fails in future versions
Can someone tell me what has to be changed to make this model compatible with 'newer' Matlab versions

Antworten (1)

Jason Ghidella
Jason Ghidella am 30 Dez. 2014
Bearbeitet: Jason Ghidella am 30 Dez. 2014
Hi Srinath,
You have not defined the parameter pdia. This parameter is needed in the constant block. You can assign a value to pdia in the base workspace such as:
pdia = 1;
Or you could write a matlab script that defines the value, and call that file in the model properties, callback, PreLoadFcn, so that it is loaded each time the model is opened. Remember to use the model dependency features to locate and save all files needed by the model.
Once I defined pdia, I was able to run the model without error in R2014b.
Also, in general, if you are having issues with upgrading from an older release, you can run the Upgrade Advisor from Analysis -> Model Advisor -> Upgrade Advisor menu item, and this will help bring your model up to date.
Finally, have you ever looked at the MATLAB Function block ? This lets you call MATLAB functions with multiple input and output arguments, and can be a lot faster than the interpreted MATLAB Fcn block.

Kategorien

Mehr zu Dependency Analysis finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by