MATLAB Answers

0

How to solve the 'StopFcn' error when the cause is "Vectors must be the same length."

Asked by sara yazdani on 19 Jul 2017
Latest activity Commented on by Walter Roberson
on 1 Aug 2019
I have got a simulation file for a grid-tie inverter, which I am going to leave its image below. When I run the simulation, I receive the following error:
Error evaluating 'StopFcn' callback of block_diagram 'DC2ACGRID2'.
Caused by:
Vectors must be the same length.
I cannot figure out what vectors are causing this trouble. Any help is very much appreciated.

  3 Comments

According to the error, the issue is not in the block diagram per se but the StopFcn callback that is calling some MATLAB commands. Assuming DC2ACGRID2 is your model name, at the MATLAB command prompt, execute the following command to see what this is:
get_param('DC2ACGRID2','StopFcn')
The output will be a call to a MATLAB m code file or a list of MATLAB commands. In the former case, put a breakpoint in the first line of this file, run the model and see that the breakpoint is activated. Then step through the code in the file to see which line errors out. In the latter case, replace the commands in StopFcn with a call to a new MATLAB m code file that contains those commands and then follow the breakpoint approach already discussed to find out the line number at which you see the issue.
"Error evaluating 'StopFcn' callback of block_diagram 'qpsk'.
Vectors must be the same length.'
I AM FACING THE SAME PROBLEM IN MY SIMULINK BLOCK, WHEN I WAS CALCILATING IN BER USING 'bertool' with simulink block.
Sorry , but i can't understand the solution,which is provided by "Sawroop".
Please explain same example,if it is possisble
get_param('qpsk', 'StopFcn')
to see what code is being executed and show us.

Sign in to comment.

0 Answers