Page 1 of 1
I cannot create new variable.
Posted: 29 Feb 2012, 03:28
by yyy
Dear all,
Now I want to create new variable.
I wrote
double myEpochLength;
in LinearClassifier.h
And, I wrote
myEpochLength = Parameter( "EpochLength" );
in LinearClassifier.cpp
(LinearClassifier::Initialize)
However, "myEpochLength" have an incorrect value.
Next, I wrote
myEpochLength = 500;
in LinearClassifier.cpp
(LinearClassifier::Initialize)
However, "myEpochLength" have an incorrect value, too.
Thanks for your attention
Kind regards
Takanori
Re: I cannot create new variable.
Posted: 29 Feb 2012, 06:54
by mellinger
Hi,
with that modification, without declaring the additional parameter in the LinearClassifier constructor, you should get an error message when accessing it in Initialize().
Also, you should initialize the new variable in the LinearClassifier constructor's initializer list (before the first brace). Otherwise, it will have a random value.
Where and how do you check the value of myEpochLength?
Regards,
Juergen
Re: I cannot create new variable.
Posted: 01 Mar 2012, 21:05
by yyy
Hi Juergen,
I am a beginner in programming.
``initialize the new variable in the LinearClassifier constructor's initializer list'' is this?
LinearClassifier::LinearClassifier()
:myEpochLength( 0 ) //myEpochLength is the new variabl.
{
BEGIN_PARAMETER_DEFINITIONS
"Filtering matrix Classifier= 2 "
"[ input%20channel input%20element%20(bin) output%20channel weight ] "
" 1 4 1 1 "
" 1 6 2 1 "
" % % // Linear classification matrix in sparse representation",
END_PARAMETER_DEFINITIONS
}
I checked the value of myEpochLength at LinearClassifier::Initialize(const SignalProperties& , const SignalProperties&).
And, I checked it while debug.
Regards,
Takanori
Re: I cannot create new variable.
Posted: 02 Mar 2012, 08:25
by mellinger
Hi,
``initialize the new variable in the LinearClassifier constructor's initializer list'' is this?
exactly, yes.
It appears you do not declare the new parameter, so it will not be found, and myEpochLength cannot be assigned any value. Parameters need to be declared before they can be used. Please read the tutorial on how to write a signal processing filter at
http://www.bci2000.org/wiki/index.php/P ... ing_Filter
Best regards,
Juergen