problem with function argument
이전 댓글 표시
i try to run a function but i receive this error: The third argument must be a real, double-precision scalar.
the function code is:[spktimes, nspikes] = SGfast([dt, nrep], rate, {deadtime, refracparams})
댓글 수: 3
Image Analyst
2013년 10월 7일
Is there some reason why you posted this again when you accepted Jan's answer on the duplicate question you posted hours ago? If not, then let me know and I'll delete this question.
Nima
2013년 10월 7일
답변 (3개)
Image Analyst
2013년 10월 7일
0 개 추천
Well, it's not. It's a cell array. Why are you passing in two cells instead of the single scalar number like it wants?
댓글 수: 2
Nima
2013년 10월 7일
Image Analyst
2013년 10월 7일
If you don't know anything about cell arrays, then why did you create one? See the FAQ: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F. You need to look at the function or the help for it to figure out how to call it - that's just standard programming practice.
Walter Roberson
2013년 10월 7일
[spktimes, {nspikes}] = SGfast([dt, nrep], rate, {deadtime, refracparams})
what it is trying to say is that nspikes and deadtime and refracparams are optional. If you want to use them then invoke with
[spktimes, nspikes] = SGfast([dt, nrep], rate, deadtime, [C0, S0, C1, S1])
댓글 수: 4
Nima
2013년 10월 7일
Walter Roberson
2013년 10월 7일
You might need to update your SGFast. The .zip is at http://www.urmc.rochester.edu/labs/carney-lab/publications/res/SGfast_MEX_files_Updated_08_2011.zip
Nima
2013년 10월 7일
Walter Roberson
2013년 10월 8일
편집: Walter Roberson
2013년 10월 8일
The problem is something to do with the MEX code, not the way you are calling it if you use the code I show above.
Use
which -all SGfast
to check to be sure you are getting the correct SGfast.mex* file. Also, execute
clear SGfast
to ensure you do not have a version "stuck" from before.
Adam Peterson
2013년 11월 15일
I just encountered this same problem today, and it seems there is a bug in the current version of the function. Just edit the file "SGfast.c" and change lines 75 and 76 to the following:
if ( (nrhs < 2) || (nrhs > 4) )
mexErrMsgTxt("Requires two, three, or four input arguments.");
Then recompile the file as normal using the mex command:
mex SGfast.c
This seems to fix the problem.
카테고리
도움말 센터 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!