How to obtain a vector (A) of 11 rows (output MATLAB Function block), from a vector (B) of 501 rows (input to the MATLAB Function block)?.
4 views (last 30 days)
Show older comments
Manuel Infante Francés on 22 Mar 2023
Commented: Manuel Infante Francés on 23 Mar 2023
Size mismatch (size [1 x 1] ~= size [10 x 1]). The size to the left is the size of the left-hand side of the assignment. More information
% The following code corresponds to the MATALAB function block that gives an error in the Simulink model in which I am working:
For more information:
If I load the vectors (A y B) in workspace and run it in command windows the desired result is obtained. I need to extract vector elements in matlab function from Simulink. If this is not possible, how can I extract the elements of the vector at the output of the function without leaving Simulink?.
Fangjun Jiang on 22 Mar 2023
The straight solution is to use below.
Simulink is strict on knowing the size of the variable and keep it fixed (although variable size is possible).
It's better to click "edit data" at the MATLAB Function block code editor and specify the size of input, output, parameters, temp variables, etc.
Find more on Additional Math and Discrete in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!