Modify multi-level structure within a matlab function block in simulink

I have a multi-level structure ("a") defined as follows,
clear all
a.test1 = 5;
a.test2 = [2 4 6];
a.b.test3 = 4;
I want to edit/add data to a.b.test3 within a matlab function block in simulink defined as follows,
function y=testing(t,a)
y = a;
y.b.test3 = [a.b.test3 t];
end
where, a is set as a parameter in model explorer, taken from the base workspace. t is scalar input.
Further, i do not want to use coder.extrinsic() as i need this for a real-time application. I found that i was not able to edit or add data to a structure within a matlab function block in simulink.

답변 (1개)

Pranjal Kaura
Pranjal Kaura 2021년 9월 3일

0 개 추천

Hey,
It is my understanding that you want to create and add data to a structure
You can refer to this documentation to learn more about creating a structure within a MATLAB function block. In particular you can look at steps mentioned in the structure scope 'Input' and 'Output'
Hope this helps!

카테고리

도움말 센터 및 File Exchange에서 Modeling에 대해 자세히 알아보기

제품

릴리스

R2017b

질문:

2019년 10월 18일

답변:

2021년 9월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by