Error in port widths or dimensions

조회 수: 3 (최근 30일)
yana osman
yana osman 2012년 2월 1일
편집: Walter Roberson 2013년 10월 10일
Hi everyone, I have a problem when running my simulink file. I have pid block and s-function block diagram in simulink file with the 11 outputs and 1 input. When I try to run this file I receive the following error for pid block:
Error in port widths or dimensions. Output port 1 of 'project1_simu/PID Controller' is a one dimensional vector with 11 elements
and the following error for s-function file:
Error in port widths or dimensions. Input port 1 of 'project1_simu/S-Function' is a one dimensional vector with 1 elements
How to solve this error?

채택된 답변

Kaustubha Govind
Kaustubha Govind 2012년 2월 1일
Apparently the S-function expects a scalar value, but you are feeding in a vector of length=11. If you've written the S-function, you need to use something like "ssSetInputPortWidth(S, 0, 11);" or "ssSetInputPortWidth(S, 0, DYNAMICALLY_SIZED);" in mdlInitializeSizes.
  댓글 수: 2
yana osman
yana osman 2012년 2월 13일
Thanks...but i received another error
" State derivatives returned by S-function 'chiu_sfcn' in 'project1_simu/S-Function1' during flag=1 call must be a real vector of length 11."
Do you have any ideas on how to solve this?
Kaustubha Govind
Kaustubha Govind 2012년 2월 13일
The error clearly states the issue. The value you are returning for flag=1 needs to be a real vector of length=11. What are you returning in "sys"?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Block and Blockset Authoring에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by