The error message is clear: bin2dec requires a CHAR vector as input or a cell string. See:
You provide a numerical vector consisting on 1s and 0s.
This part of the code does not assigbn the results to a varible, so the computations are lost and only a waste of time:
What do you want to achieve? a and e are not changed here.
The result A is overwritten in each iteration:
At the end, A contains the value of the last iteration k=N only. Is this wanted?
What is the wanted output for: