how add characters to sequence?
1 次查看(过去 30 天)
显示 更早的评论
hi, I have this seq. for example qwe hj l
what I need is adding gaps in spaces of this sequence, such qwe---hj--l
I want code do that
many thanks in advance
回答(1 个)
Andrei Bobrov
2012-2-27
out = regexprep('qwe hj l',' ',' ')
or
a = regexp('qwe hj l',' ','split');
out = cell2mat(cellfun(@(x)[x,blanks(length(x))],a,'un',0))
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!