필터 지우기
필터 지우기

Syntax error with Fcn block in simulink

조회 수: 9 (최근 30일)
J. Olondriz
J. Olondriz 2017년 1월 16일
댓글: J. Olondriz 2017년 1월 23일
Dear all,
I am getting a syntax error in Simulink in a Fcn block:
u(strmatch('Name',OutList))
Error:
Error using Run_Simu (line 16)
The expression: u(strmatch('Name',OutList))
in 'Directory of the file'
has a syntax error Error using Run_Simu (line 16)
I need to find Name from a string array in OutList (sometimes the order of the strings change, so that "strmatch"). The error is displayed only the first time. But if I need to implement the simulink model in a loop it is imposible due to the error.
How can I avoid the error or find the string in another way?
Thanks in advance, JOE

채택된 답변

Chinmayi Lanka
Chinmayi Lanka 2017년 1월 19일
You cannot use the 'strmatch' function inside the Simulink 'Fcn' block. The 'Fcn' block only supports Mathematical functions: http://www.mathworks.com/help/simulink/slref/fcn.html
You can instead use the Interpreted MATLAB Fcn block: http://www.mathworks.com/help/simulink/slref/interpretedmatlabfunction.html
  댓글 수: 1
J. Olondriz
J. Olondriz 2017년 1월 23일
Dear Chinmayi,
Your right. Now works without errors.
Thank you!

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by