フィルターのクリア

problem with function argument

2 ビュー (過去 30 日間)
Nima
Nima 2013 年 10 月 7 日
回答済み: Adam Peterson 2013 年 11 月 15 日
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
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
Nima 2013 年 10 月 7 日
sorry i think i made a mistake. i accepted the Jan's answer for the another question and wrote the new question again on the comments

サインインしてコメントする。

回答 (3 件)

Image Analyst
Image Analyst 2013 年 10 月 7 日
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
Nima 2013 年 10 月 7 日
actually i dont know about cell arrays and function is written by someone else and i just want to use it in my case. so please tell me what exactly i should do with this
Image Analyst
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
Walter Roberson 2013 年 10 月 7 日
You (or someone) are accidentally misreading the documentation. In the place it says
[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
Nima 2013 年 10 月 7 日
tried with the updated one but i got the same error:
Error using SGfast
Requires two or three input arguments.
Walter Roberson
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
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.

カテゴリ

Help Center および File ExchangeWrite C Functions Callable from MATLAB (MEX Files) についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by