finished coding new input encoding matlab