Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Simulink Block IO signal data type reference inside the fcn block

1 visualización (últimos 30 días)
legendbb
legendbb el 26 de Feb. de 2013
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Dear experts,
Just wondering if it is possible to reference I/O data type specified in "Edit Data" inside a fcn block, while doing value assignment.
For example, input "u" is defined as "fixdt(1,9,0)" in "Ports and Data Manager". Currently I have to do this explicitly: "u = fi(3, 1, 9, 0)" if I wanna say "u=3".
I am thinking it will be convenient if I could just do "u = fi(3, numerictype(u))".
Thanks,
  7 comentarios
Kaustubha Govind
Kaustubha Govind el 4 de Mzo. de 2013
"Error: Undefined function or variable 'u'. The first assignment to a local variable determines its class." - this means that "u" is not defined as ta local/input variable in the function. I assumed "u" was your input because you posted the 'u=fi(3,numerictype(u))' line originally as a desirable syntax.
legendbb
legendbb el 4 de Mzo. de 2013
Hi, Kaustubha,
Originally, I might confused myself by trying to reference data type for output. I knew for sure it generates the abovementioned error, if I define explicitly data type for "output y" and try to reference its data type inside fcn code, for instance:
function y = f(u)
reg_y = fi(0,numerictype(u));
y = reg_y;
end

Respuestas (0)

La pregunta está cerrada.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by