"??? Undefined function or variable 'v_pT'."

I downloaded IAPWS_IF97.m file. I try to use any of the noted functions but Matlab just states:
"??? Undefined function or variable 'v_pT'."
I can write other functions and they work. I guess it is something in the .m file.
Any help is greatly appreciated.

3 commentaires

Stephen23
Stephen23 le 12 Mai 2016
Modifié(e) : Stephen23 le 12 Mai 2016
So you downloaded an Mfile (but you are not going to show us where from), and when you try to use the Mfile (and you don't show us how you try to use it) the Mfile gives an error (which you showed only one line of) and you suspect that "it is something in the .m file" (but of course you did not show us the Mfile either).
Now let me read my crystal ball and check my tarot cards to find out what the problem is...
Or would you prefer to actually give us some real information to help us diagnose the problem?
Taylor
Taylor le 12 Mai 2016
So nice..
I put the IAPWS_IF97.m file in my file path. Matlab acknowledges the functions in the bottom left screen.
I try typing in IAPWS_IF97(v_pT, 50, 290) but it provides me error in my question.
Stephen23
Stephen23 le 13 Mai 2016
Modifié(e) : Stephen23 le 13 Mai 2016
You forgot to make the first argument a string:
IAPWS_IF97('v_pT', 50, 290)
This is shown quite clearly in the documentation given at the link you gave.

Connectez-vous pour commenter.

Réponses (2)

Walter Roberson
Walter Roberson le 12 Mai 2016

0 votes

3 commentaires

Taylor
Taylor le 12 Mai 2016
So I place the IAPWS_IF97 file in the path. Matlab shows the functions in the bottom left screen. It is just when I try to use the function in the workspace like so:
IAPWS_IF97(v_pT, 50, 290)
It give me the error I provided above.
Can you try typing that function in above and see if it works for you?
John D'Errico
John D'Errico le 12 Mai 2016
Have you actually defined the variable v_pT in the current workspace, so that it can be passed into this function?
IAPWS_IF97('v_pT', 50, 290)

Connectez-vous pour commenter.

John D'Errico
John D'Errico le 12 Mai 2016
I'll guess your problem is for some reason, you have not bothered to define the variable v_pT that you are then passing into the function.
MATLAB is telling you that you have not done so. It would give anyone exactly the same error, IF they had no variable with that name in their workspace, but then tried to call the function as
IAPWS_IF97(v_pT, 50, 290)
You have not provided enough information to know this is the answer. But your apparent lack of understanding of MATLAB in general seems to suggest this as the case.

2 commentaires

Taylor
Taylor le 12 Mai 2016
Modifié(e) : Taylor le 12 Mai 2016
Okay, I got it. I'm suppose to use 'v_pT'... That is the function I am trying to find per the instructions. So it isn't suppose to be an input variable.
I will try when I get home.
John D'Errico
John D'Errico le 12 Mai 2016
I don't know if this is intended to be a function, as part of what you downloaded, or if it is a variable. But MATLAB cannot find something with that name in your workspace, or in your directories.

Connectez-vous pour commenter.

Catégories

Question posée :

le 12 Mai 2016

Modifié(e) :

le 13 Mai 2016

Community Treasure Hunt

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

Start Hunting!

Translated by