MATLAB Answers


How to split a String ?

Hi ,

I have a string 2-1 . I want to split this into Two different strings 2 and 1.

Can someone please throw some light on how to use the split string function.

Thanks in Advance.


oops..... just got it

s2 = regexp(string, '-', 'split')

the cyclist
on 19 Jun 2013

You should put this comment as an answer below, and then accept that answer. That will help people looking for similar solutions later.


No products are associated with this question.

1 Answer

Answer by sujayandra vaddagiri on 26 May 2014
 Accepted answer

s2 = regexp(string, '-', 'split')


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!