Expected a value representable in the C type 'int'.

조회 수: 48 (최근 30일)
vishnuvardhan naidu tanga
vishnuvardhan naidu tanga 2020년 2월 17일
댓글: jerinsam jerin 2023년 11월 6일
Hello everyone,
I am simulating a simple equation in simulink as a matlab function block. and i am getting the following error, The code is also as follows#
function dHdt = fcn(R, L, H, m_s, m_w)
dV_wdL = 2*L(sqrt(2*R*H-H^2));
dHdt = (m_w-m_s)/(dV_wdL*(997-0.592));
The error is as follows
Expected a value representable in the C type 'int'. Found 0.489898 instead.
Error in 'onelast/MATLAB Function2' (line 3)
dV_wdL = 2*W(sqrt(2*R*L-L^2));
Component:Stateflow | Category:Runtime error
Index exceeds array dimensions. Index value 0 exceeds valid range [1-1] of array L.
Error in 'onelast/MATLAB Function2' (line 3)
dV_wdL = 2*W(sqrt(2*R*L-L^2));
Please help me with this.
Thank you in advance.
  댓글 수: 3
James Tursa
James Tursa 2022년 1월 21일
편집: James Tursa 2022년 1월 21일
In the code above it looks like there is a missing multiply operator. The 2*L(sqrt... should be 2*L*(sqrt(...
Similar comments for the 2*W(sqrt...
What does your code look like? Maybe you should open up a new Question.
jerinsam jerin
jerinsam jerin 2023년 11월 6일
Thanks James,
I also had the same issue and now it works.
The error Matlab shows and the solution to that problem is completely different.

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by