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

1 回表示 (過去 30 日間)
Srinath
Srinath 2014 年 12 月 26 日
編集済み: Jason Ghidella 2014 年 12 月 30 日
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

回答 (1 件)

Jason Ghidella
Jason Ghidella 2014 年 12 月 30 日
編集済み: Jason Ghidella 2014 年 12 月 30 日
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.

カテゴリ

Help Center および File ExchangeDependency Analysis についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by