Pan Conflict Error
A naming conflict occurs because there is a Matlab function (pan.m) and an OpenECU model library (pan.mdl) with the same name. Either the Matlab function or the OpenECU model may be shadowed by the other, depending on the order of directories in your Matlab search path. This may cause any of the following errors:
??? Error using ==> putdowntext at xyz pan. ??? Error while evaluating uitoggletool ClickedCallback ??? Simulation of model 'pan' is not allowed because it is a block diagram library. Warning: The file containing block diagram 'pan' is shadowed by a file of the same name higher on the MATLAB path. This can cause unexpected behaviour.
To verify which file is shadowed, you can use the following command at the MATLAB command prompt:
>> which('pan', '-ALL') C:\openecu\model\pan.mdl C:\MATLAB\toolbox\matlab\graph2d\pan.m % Shadowed
The MATLAB pan.m function is used for panning in figures. It gets called when you click on the pan mode button. The OpenECU pan.mdl model contains the blockset related to angular functions, typically used in engine control applications.
Changing the Path Manually
The conflict can be resolved by changing the MATLAB path order so that whichever pan file you intend to use is listed first. To change the path order in MATLAB:
Click File->Set Path...
In the Set Path window, select the path containing \openecu\model
Click Move to Top if you want to work with the OpenECU model, or Move to Bottom if you want to use the pan feature in a MATLAB figure.
NOTE: You have to change the path before opening the model or creating a figure in order for the change to take effect. If you don't do this, you will continue getting the error or warning.
Changing the Path Automatically (OpenECU v2.4.0 and Newer)
OpenECU v2.4.0 contains a MATLAB script which can adjust the path for you.
This example shows how to temporarily change the path in order to open and build the model, and then restore the path so that the MATLAB pan feature may be used.
oe_adjust_model_path('begin'); % moves the \openecu\model directory to the top of the MATLAB search path open('model'); rtwbuild('model'); oe_adjust_model_path('end'); % moves the \openecu\model directory to the bottom of the MATLAB search path
For more details about this issue see
- MATLAB help on 'Shadowed Functions' and 'Search Path'