How to avoid temporary variables when using a global signal/data store

조회 수: 2(최근 30일)
Gerhard Feichtinger
Gerhard Feichtinger 2015년 6월 24일
댓글: Gerhard Feichtinger 2015년 7월 8일
I have a data store read from a global signal (ism_io_bus_global). No matter what I name the ougoing stick, I get code that looks similar to the following after code generation.
/* DataStoreRead: '<S2>/ism_io_DSR' */
crap_local_B.crap_name_mb = ism_io_bus_global;
/* ModelReference: '<S2>/func' */
func
(&crap_local_B.crap_name_mb.sub_2.sub_A.field_1,
crap_local_B.crap_name_mb.sub_1.sub_B.sub_x.field_2);
What I want is code that simply calls the next function from the global signal subfields, e.g.
/* ModelReference: '<S2>/func' */
func
(&ism_io_bus_global.sub_2.sub_A.field_1,
ism_io_bus_global.sub_1.sub_B.sub_x.field_2);

채택된 답변

Drew Davis
Drew Davis 2015년 6월 25일
Check out this documentation page which talks about how to enable your model with expression folding and minimizing data copies between local and global variables.
  댓글 수: 1
Gerhard Feichtinger
Gerhard Feichtinger 2015년 7월 8일
Thanks, Drew -- sorry for the late response, I think my email needs to be updated here. Good stuff.

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by