pcode always complains "Input argument is undefined."
Show older comments
I tried it both in windows and unix, and I just dont understand why it happens. I have a function in its file.
% Beginning of file
function [MarginPOR] = creditFunc_prod1 ( Notional , MaxNotional )
%Linearly interpolate the probability of loss and stressed loss greater than 0
display('Using the OFFICIAL UNIX PRODUCTION creditFunc...');
MarginPOR = Notional + MaxNotional;
end
% End of file
Then I do this two,
>> pcode(creditFunc_prod1, '-inplace');
Using the OFFICIAL UNIX PRODUCTION creditFunc...
??? Input argument "Notional" is undefined.
Error in ==> creditFunc_prod1 at 7
MarginPOR = Notional + MaxNotional;
>> a= creditFunc_prod1(1,2)
Using the OFFICIAL UNIX PRODUCTION creditFunc...
a =
3
>>
If someone can help me understand why this happens, it will be really great.
Answers (2)
Jinghua Cao
on 15 Nov 2013
0 votes
Kelly Kearney
on 15 Nov 2013
Edited: Kelly Kearney
on 15 Nov 2013
The documentation is fine. However, the fun input is supposed to be the file name:
pcode('creditFunc_prod1', '-inplace');
Note the quotes around the first argument. As you were calling it, Matlab interpreted the first argument not as the name of the function but as a call to the function, and tried to run it as presented, with no arguments. That leads to the error.
So it's not pcode that's complaining, but your own function.
1 Comment
Jinghua Cao
on 15 Nov 2013
Categories
Find more on Debugging and Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!