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 CenterFile Exchange에서 Dependency Analysis에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by