필터 지우기
필터 지우기

Error with inport signal names when using a Model block

조회 수: 4 (최근 30일)
Eduardo Garcia
Eduardo Garcia 2024년 1월 18일
댓글: Fangjun Jiang 2024년 1월 18일
Hello.
I am trying to create en Export Function Model as outlined here (Using Initialize, Reinitialize, Reset, and Terminate Functions - MATLAB & Simulink (mathworks.com)). I have gotten thru it all just liek instructed, but i get an error when i compile the model.
Looking at the Model block subsystem, i can see that the signal is complainig about, do not show up named in the subsystem (See screenshot)
If you open that subsystem (Reference model) and check the inports and signal names, they are named.
I have tried to set the signal names using the set_param(), but i get this error and i do not understand how to get around it. I have also tried to name the line and get the same error.
Any help is appreciated on how i can fix this error.
Thank you.

채택된 답변

Fangjun Jiang
Fangjun Jiang 2024년 1월 18일
You have to set the name of the line (line handle), not port (port handle). Outside the Model block, try to set the line name manually to see if it resolves the error.
  댓글 수: 2
Eduardo Garcia
Eduardo Garcia 2024년 1월 18일
I have tried to set the line name and get the same error.
linehandle = get_param(newblockhandle{1},'LineHandles');
set_param(linehandle.Outport(1),'Name',Ports.top.portname{i})
It did work manually. Not sure why i didnt think about testing it manually.
I am still confused as to why it would work manually and not with set_param().
Thanks for the response.
Fangjun Jiang
Fangjun Jiang 2024년 1월 18일
Carefully review if there is any difference in the signal name between manual entry and by script, such as trailing white space or new line. Read it back in script to check the value too.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Event Functions에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by