MATLAB Answers

Why do I get the error '??? Output argument ‹variable› (and maybe others) not assigned during call to ‹function›.' ?

조회 수: 3(최근 30일)
Nasir Abbas
Nasir Abbas 2021년 9월 8일
댓글: Nasir Abbas 2021년 9월 8일
I am actually trying to run a source code that is termed as FESTIV.m used in Electrical Engineering. It needs another software GAMS to be installed as well and i have installed it as well. now when i am running the festiv.m code. it is giving me this error
Output argument "gamspath" (and maybe others) not assigned during call to "getgamspath".
Error in FESTIV (line 94)
gamspath=getgamspath();
I have attached the festiv.m file.

답변(3개)

Rik
Rik 2021년 9월 8일
The error is in getgamspath. Consider this function:
function [output1,output2]=IncorrectFunction
output2=1;
end
Running it results in the error you saw:
answer=IncorrectFunction
Output argument "output1" (and maybe others) not assigned during call to "solution>IncorrectFunction".

Walter Roberson
Walter Roberson 2021년 9월 8일
Reading through https://github.com/NREL/FESTIV_MODEL/blob/master/getgamspath.m I can see that that problem can occur under these circumstances:
  • file pathfile.txt already exists in the current directory, and has exactly one entry that mentions GAMS, but when you use that entry as a foldername to look for gamside.exe then there is no gamside.exe there. In such a case, the code does not give a warning or message: it just fails to set the output variable gamspath; OR
  • file pathfile.txt already exists, and has either more than one entry that mentions GAMS, but when the program asks Windows to CD \ & dir gamside.exe /s then no gamside.exe is found anywhere under \ . This process ignores the contents of pathfile.txt other than to find out that there are multiple GAMS lines. Failure to find the file not strictly imply that gamside.exe does not exist anywhere on the computer: it could mean that it is on a different partition for example.
  • file pathfile.txt does not exist in the current directory, or does exist but has no entries that mention GAMS, but when the program asks Windows to CD \ & dir gamside.exe /s then no gamside.exe is found anywhere under \ . This process ignores the contents of pathfile.txt (if it exists at all) other than to find out that there are no GAMS lines. Failure to find the file not strictly imply that gamside.exe does not exist anywhere on the computer: it could mean that it is on a different partition for example.
Note that it is always the current directory that is looked in when getgamspath is invoked.
Probably the most common circumstance is that the pathfile.txt either does not exist or else is empty. The file is created as empty if it does not exist, but after the function finds what it thinks is a possible path, it does not write the path found into the file, so a slow search for the executable would be done all over again...

Nasir Abbas
Nasir Abbas 2021년 9월 8일
I updated the pathfile.text with the gamside.exe location and then it worked. I am not having the same error again. But now it is giving some other warnings and errors. the screenshot of that error is added.
  댓글 수: 6
Nasir Abbas
Nasir Abbas 2021년 9월 8일
i read the whole installation notes for windows but i did not found anything related gams.exe rather they talked about studio..exe.
can the newer verions of softwares be the reason these errors.

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

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by