I cannot create new variable.

Forum for software developers to discuss BCI2000 software development
Locked
yyy
Posts: 3
Joined: 29 Feb 2012, 02:38

I cannot create new variable.

Post by yyy » 29 Feb 2012, 03:28

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

mellinger
Posts: 1052
Joined: 12 Feb 2003, 11:06

Re: I cannot create new variable.

Post by mellinger » 29 Feb 2012, 06:54

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

yyy
Posts: 3
Joined: 29 Feb 2012, 02:38

Re: I cannot create new variable.

Post by yyy » 01 Mar 2012, 21:05

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

mellinger
Posts: 1052
Joined: 12 Feb 2003, 11:06

Re: I cannot create new variable.

Post by mellinger » 02 Mar 2012, 08:25

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

Locked

Who is online

Users browsing this forum: No registered users and 1 guest