Spiking neurons with lumped nonlinearity representing active dendrites can perform a larger number of input-output mappings than is possible by a neuron with linear synaptic summation of its currents. This is possible due to the additional degree of freedom in such cells-its `morphology' reflected in the number of dendrites and the choice of which inputs form synapses on the same dendrite. We present a hardware friendly algorithm for learning such optimal morphologies utilizing correlations between inputs and dendritic branch activations. We demonstrate the increased memory capacity of neurons with nonlinear dendrites and binary synapses over typically used linearly summing cells with high resolution weights. We have shown that a neuron model with a fixed number of binary weights performs much worse on a pattern classification task when it uses traditional linear dendrites than when it utilizes nonlinear dendrites (19% compared to 9% errors for 1000 patterns). This method allows to trade-off weight resolution, a problem in most current neuromorphic systems, with configurability that is the strength of address event representation (AER) based systems which can store configuration details in an off-chip memory. On a fundamental level, it points to the need of having a higher ratio of nonlinear to linear operations in spiking neural networks than is typically used.