A method for creating brain-machine interface based on received and filtered brain signals from a subject, classifying the filtered signals to classes of brain states, detecting one brain state from the classified brain states and executing by a machine a command that corresponds to the detected state.