Working with variable in Simulink

조회 수: 1 (최근 30일)
Jill
Jill 2011년 8월 22일
I have a variable name that I am using in a block (the variable name is one of the masked parameters). I would like to modify this variable by reading a value that I receive through a message. I have looked into the data store block and tried writing this variable to that block with a data store write. I use the same name as in my parameter mask but the value doesn't change (I don't think it can access my data store). I am new to simulink so I may be just using the data store incorrectly.

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 8월 22일
I don't think you can do that. Let's clarify. You have a masked subsystem block which has a masked parameter. You put variable par1 for that parameter. The value of variable par1 is 1 in the baseworkspace initially. You want to receive a message (whatever is that), then change the value of par1 and hope it will take effect for the masked subsystem block.
If that is the case, Data Store Memory/Read/Write block can not help you achieve that.
  댓글 수: 2
Jill
Jill 2011년 8월 22일
I am using the Vehicle network toolkit and the CAN pack block. I want to send out a message with a CANid that I have extracted from a lookup table that corresponds to the data measurement that I am sending out. I have defined the identifier in the CAN Pack to be CANid (which is a value I extracted from a lookup table and then put in my data store for CANid). Is this not allowed? Is there any way of having a CAN pack that handles a variable CANid? I don't want to have 60 CAN pack blocks in my model(one for each type of message to send).
Fangjun Jiang
Fangjun Jiang 2011년 8월 22일
Is the CANid the masked parameter you are talking about? I think you have to have 60 CAN pack blocks if you do want to receive/send 60 CAN messages. Otherwise, how do you do the switching?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Create Large-Scale Model Components에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by