필터 지우기
필터 지우기

Function variables are resolved in the workspace, not a .Simulink.Signal. object

조회 수: 47 (최근 30일)
This is part of an encryption algorithm that produces a matrix.
Variable 'img' is resolved in workspace ('base') for block 'test01/MATLAB Function4' but it is not a 'Simulink.Signal' object.
  댓글 수: 7
wang
wang 2023년 1월 31일
편집: wang 2023년 1월 31일
Thank you very much for your answer
What I want to do is to build The plan is to run MATLAB and call the model to implement image encryptionmage encryption part of the algorithm. The plan is to run MATLAB and call the model to implement image encryption.
Paul
Paul 2023년 1월 31일
It would be better to copy/paste the code here as text rather than an image.
Is lambd a scalar? If not, that code won't run at all because the output of mod is a matrix and X(i) is sclar.
Also, I suspect that reshape call is going to be a problem. The code generator needs to be able to figure out the size of img based on the code and/or the properties of the input and ouputs to the function, not the values of the inputs. Unless maybe img is supposed to be a variable size array.
Setting all that aside, this code in and of itself should not be causing any errors about img being global. I think there's a lot more about the workflow that causes the the problem, which hasn't been shown here.

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

채택된 답변

Fangjun Jiang
Fangjun Jiang 2023년 1월 31일
편집: Fangjun Jiang 2023년 1월 31일
In the MATLAB Function block editor, click menu button "Edit Data", in the "Property Inspector", "Symbols" section, find and select the item for "img". In the "Advanced" section, you must have checked the "Data must resolve to signal object" option.
If this is not your intention, un-check it. It seems that this is likely the case. This will get rid of this error.
If it is, then you need to create a Simulink.Signal object in base workspace and set many properties.
img=Simulink.Signal
open img

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by