Why do I receive an error when I use the colon operator (:) in the Embedded MATLAB Function block as described in the documentation for Simulink 6.1 (R14SP1)?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
The documentation associated with the Embedded MATLAB Function block in Simulink 6.1 (R14SP1), accessible by typing the following at the MATLAB prompt:
web ([docroot '/toolbox/simulink/slref/eml_blocks_ref13.html#limitations_on_indexing_operations'])
includes the following text and example:
* M(i:j) where i and j change in a loop
Embedded MATLAB never dynamically allocates memory for the size of the expressions that change as the program executes. The workaround is to use for loops as shown in the following example:
for i=1:10
for j = i:10
M(i:j) = 2 * M(i:j);
end
end
However, when I use the preceding code featuring the color operator (:) in the Embedded MATLAB function block, the following errors are returned:
Size of index expression is not statically known.
Function 'Embedded MATLAB Function' (#32.175.178), line 7, column 11:
"i:j"
Errors occurred during parsing of Embedded MATLAB function 'Embedded
MATLAB Function'(#32)
Embedded MATLAB Interface Error: Port width mismatch. Input port "u"(#36) expects a scalar. The signal is a one dimensional vector with 1 elements.
Respuesta aceptada
MathWorks Support Team
el 27 de Jun. de 2009
This bug has been fixed in Release 14 Service Pack 2 (R14SP2). For previous releases, please read below for any possible workarounds:
We have verified that there is an error in the "Limitations on Indexing Operations" section of the documentation associated with the Embedded MATLAB Function block in Simulink 6.1 (R14SP1).
The correct version of the documentation should read as follows:
* M(i,j) where i and j change in a loop
Embedded MATLAB never dynamically allocates memory for the size of the expressions that change as the program executes. The workaround is to use for loops as shown in the following example:
for i=1:10
for j = i:10
M(i,j) = 2 * M(i,j);
end
end
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Communications Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!