Unrecognized function or variable 'uu'. Error in 'TBSv1/desired trajectory' while evaluating expression.
이전 댓글 표시
I have a block taking input as only time, but the error keeps poping up,
- Unrecognized function or variable 'uu'.
- Error in 'TBSv1/desired trajectory' while evaluating expression.
How to solve this error? My code works fine if i use Matlab function instead of integrated matlab function.
here is the code in the block for reference
function out=DesiredTrajectory(uu,P)
t=uu;
ytraj= [8;8;20];
ydottraj= [0;0;0];
yddottraj= [0;0;0];
out=[...
ytraj;...
ydottraj;...
yddottraj];
댓글 수: 5
Walter Roberson
2020년 6월 18일
Your MATLAB Function Block in Simulink does not have at least one input signal.
Twinkle Patel
2020년 6월 19일
Walter Roberson
2020년 6월 19일
What is the other input, P ?
Is it correct that your actual code ignores t after setting it, and ignores P, and always emits that 9 x 1 matrix?
Twinkle Patel
2020년 6월 19일
Walter Roberson
2020년 6월 19일
Please attach your model for testing.
답변 (1개)
Mara
2020년 6월 18일
0 개 추천
If you call this function, you need two inputs inside the bracket:
out = DesiredTrajectory(uu, P)
It sounds to me like you might have uu in your workspace, so the code runs fine when you evaluate the selection. But when you call a function, it does not have access to that. It only has access to the variables that you give it as an input, in this case uu and P.
Maybe try to check it. Put a breakpoint at the line t = uu and see if uu appears in the workspace.
Hope I could help!
댓글 수: 3
Twinkle Patel
2020년 6월 18일
Mara
2020년 6월 18일
Alright, I am sorry but I cannot help you with this. As far as I understood, the problem is not the function but the code from where you call it. I wish you good luck
Twinkle Patel
2020년 6월 19일
카테고리
도움말 센터 및 File Exchange에서 Signal Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!