I have this seq. for example
qwe hj l
what I need is adding gaps in spaces of this sequence, such
I want code do that
many thanks in advance
Direct link to this comment:
I will write the sequence clearly
'qwe hj l'
No products are associated with this question.
Direct link to this answer:
out = regexprep('qwe hj l',' ',' ')
a = regexp('qwe hj l',' ','split');
out = cell2mat(cellfun(@(x)[x,blanks(length(x))],a,'un',0))
but the result is not what I need
when use regexprep, I got
qwe hj l
i have long sequences, this is just example , I need something more general.
i.e I need code palce '-' in any space find it.
I can not get the index of spaces, this is my problem.
ex. z='qwe hj l';
if z(i)==' '
this is code did not get the spaces, also when use if z(i)==.
So, how I can get the index of spaces?
i tried use if
regexp('qwe hj l',' ')
MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Opportunities for recent engineering grads.
New to MATLAB?
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Choose your country to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a location from the following list:
See all countries