Matlab2014a pcode and functions: cannot generate pcode due to input argument error?
显示 更早的评论
When I attempt to pcode any function, however basic the same error message appears 'Not enough input arguments' this error occurs the first time any input argument to the function is used. If I attempt to write a function without any arguments and pcode it, it returns the error 'Input argument must be a nonempty string.'
Again, I must emphasise that the functions themselves work, and return no error messages. The only time error messages appear is when I attempt to pcode them.
I have just updated from 2006b (yes I know very old!) so I need to redo all of my previous pcodes in this version but cannot! Any help would be MUCH appreciated.
7 个评论
Philip Borghesani
2014-9-18
Something strange is going on. Post the exact commands you are typing and errors you get and example of a function you are attempting to pcode and even the .p file you have produced by pcoding it.
When the m and p file are in the same directory you should be able to debug normally so try setting a breakpoint in the function.
Emma
2014-9-19
Andreas Goser
2014-9-19
It would be great in case you can reproduce it, that you contact MathWorks Technical Support, so that it can be tested whether this is a bug or not.
Greg
2016-3-18
I'm having the same problem:
>> pcode(main2048(dataset),'-inplace') Error using pcode (line 83) Input argument must be a nonempty string.
>> pcode(main2048,'-inplace') Error using main2048 (line 58) Not enough input arguments.
The function is:
function [dataset_out, dataset_out_exp]=main2048(dataset)
and runs without issue. Any ideas on why my pcode generation isn't working?
jgn
Greg
2016-3-18
Forgot to add:
>> which pcode -all C:\Program Files\MATLAB\R2014b\toolbox\matlab\general\pcode.m
jgn
Steven Lord
2016-3-18
PCODE requires the NAME of the function from which the p-coded file is to be generated as input. In your first attempt you're calling main2048 with the variable dataset as input and attempting to use whatever it returns as the name of the file to pass into PCODE. In your second attempt you're calling main2048 with no input arguments and attempting to use whatever that returns as the name of the file.
Try:
pcode('main2048')
Greg
2016-3-18
Ignore above. I wasn't using the correct call. It should be:
pcode main2048
This worked fine.
jgn
回答(3 个)
Andreas Goser
2014-9-18
It might be you have something other called pcode on your path. Please execute
which pcode -all
It should return only something like this
C:\Program Files\MATLAB\R2014a\toolbox\matlab\general\pcode.m
If you have more, you know which function or variable casues the trouble.
Iain
2014-9-18
I know this is probably obvious, but you are using "pcode" correctly?
pcode filename
or
pcode('filename')
Jaco
2014-12-2
0 个投票
I get the same error when using pcode. If I rename my file to all lower case it still gives the same error?? I'm using 2014b
1 个评论
Andreas Goser
2014-12-3
Please provide the information asked by Philip and I:
"Post the exact commands you are typing and errors you get and example of a function you are attempting to pcode and even the .p file you have produced by pcoding it."
and
which pcode -all
类别
在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!