Array indices must be positive integers or logical values
Show older comments
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 Comments
Ryley Hindman
on 12 Apr 2022
What data types are your variables in this equation? Please share your workspace variables.
Walter Roberson
on 12 Apr 2022
Check to see if you have a variable named loginv or a variable named log
Muhammad Azhar
on 12 Apr 2022
Voss
on 12 Apr 2022
Can you upload the file untitled.m (using the button with the paperclip icon)?
Answers (1)
Voss
on 12 Apr 2022
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.
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!