-
2 Comments
Khaled Hamed
on 1 Aug 2012
The problem asks to "add" a zero, no mention of append or prepend! Nice general solution though, and a new trick learned ($&0)
Donovan Greene
on 22 Jun 2017
I feel I've overcomplicated my solution
regexprep(x, '(?(?=0[^0]|0$)0|)', '00')
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!