Debug error in Simulink Matlab Function block

Hi,
I have a Matlab function block with this code:
function [out1,out2]=control(in1,in2,parameters)
%#codegen
[in1,in2]= control_v_0_1(in1,in2,parameters)
where control_v_0_1 is a simple matlab function in my directory. When I run model, error in control_v_0_1 isn't visible, but appears a global error:
Error occured during parsing of MATLAB function 'control'
Error in port widths or dimensions. Output port 1 of 'model/control/in1' is a one dimensional vector with 1 elements
I would like check single error in the function file control_v_0_1. Is possible?
Thanks DV

4 Comments

It doesn't seem like the error is inside the function, but possibly in how the output signal is being used. Is there a downstream block expecting a non-scalar signal from the output of the function? Perhaps it will help if you include a snapshot of your model. See http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
Ok I have partialy resolved the problem.
I ran the model from command line with command sim('model_name'). I watched the error from command windows end only error than I saw , was:
Error occured during parsing of MATLAB function 'control'
Error in port widths or dimensions. Output port 1 of 'model/control/in1' is a one dimensional vector with 1 elements
but now I run the simulation from Simulink windows and I view the errors report with all errors from m file with my function (there aren't ports dimension error). Good.
Is it possible view this error directly on command windows?
Thanks for answer
Unfortunately, I don't think so. I believe the MATLAB Function block parsing errors are only reported in the pop-up error window, but not in the command window.
Thanks for answer.

Sign in to comment.

Answers (0)

Products

Asked:

on 25 Jun 2013

Community Treasure Hunt

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

Start Hunting!