Array indices must be positive integers or logical values

Array indices must be positive integers or logical values.
Error in untitled (line 49)
pb = logninv ( ((C8 /Tb)+C9+(C10*Tb)+(C11*Tb^2)+(C12*Tb^3)+C13*log(Tb)) ); %"Wexler's Equation for Saturatoin pressure"
Can Anyone help me in this issue!

댓글 수: 4

What data types are your variables in this equation? Please share your workspace variables.
Check to see if you have a variable named loginv or a variable named log
There is no variable named logninv or log
Can you upload the file untitled.m (using the button with the paperclip icon)?

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

답변 (1개)

Voss
Voss 2022년 4월 12일
Do you have variables called log or logninv?
If so, MATLAB will treat, e.g., log(Tb) as taking element(s) at index Tb in the array log, rather than calling the log function with argument Tb.
Since there are no other possible indexing operations on that line, it seems likely that log and/or logninv has been used as a variable name. To find out, you can do this right before that line:
whos log*
If there are any variables called log or logninv that show up when you do that, you should rename them in your code to something that doesn't have the same name as a function you want to call.

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

태그

질문:

2022년 4월 12일

댓글:

2022년 4월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by