필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Using vector inputs for MATLAB Function block for code generation

조회 수: 1 (최근 30일)
Sam
Sam 2023년 10월 27일
마감: Sam 2023년 10월 31일
Lets assume I use the following functions within a "MATLAB Function block" in Simulink (see below).
If these two functions are within a "MATLAB Function block", only the optimisation_AD() is visible from Simulink.
optimisation_AD() has a vector input of type single, lets say input_var = ones(10:1) and a single output
function fun_out = optimisation_AD(input_var)
fun_out = Test_simple_fun(input_var);
end
function [y_output] = Test_simple_fun(x_input)
y_output_tmp = single(0);
for n = 1:length(x_input)
y_output_tmp = y_output_tmp + x_input(n);
end
y_output = y_output_tmp/length(x_input);
end
When I pass a vector (I use the tapped delay block) to optimisation_AD() as the input, the functin does not work.
It seems like, it is not possible to pass a vector to the "main function" of a "MATLAB Function block".
However, if I would define a vector within otimisation_AD() and pass it to Test_simple_fun(), as can be seen above,
it works. How is this possible?
I want to generate C-Code from the Matlab function block.

답변 (0개)

이 질문은 마감되었습니다.

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by