I am afraid you can't easily implement it with the existing tools.
There are some papers out there (googling portfolio optimization cardinality constraints): http://www.ra.cs.uni-tuebingen.de/publikationen/2003/streichert03evolutionary.pdf
MATLAB related links that might help you:
- http://www.mathworks.co.uk/products/optimization/demos.html?file=/products/demos/shipping/optim/portfoptimdemo.html
- http://www.mathworks.com/matlabcentral/fileexchange/18126
- The authors claim they coded their algorithm in MATLAB, you may ask them: http://arxiv.org/ftp/arxiv/papers/1105/1105.3594.pdf
