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

Thread Subject:
Convert string with spaces into a cell

Subject: Convert string with spaces into a cell

From: Camille Couzi

Date: 4 May, 2012 06:14:07

Message: 1 of 2

Hi matlab friends,

I am stuck on a very basic thing, I can't find my way to it...
I have a serie of strings:
A='% 90 Directions and 128 Frequencies'

I want to get the numbers 90 and 128.

I though and easy way would be to convert my string A into an ordered cell containing separately my words '%', '90', 'Directions',...
and then I would just take the value in the 2nd element (90) and the one in the 5th element (128).

But how can I do that? ("convert my string A into an ordered cell containing separately my words ...")??
Thanks for your help...
Camille.

Subject: Convert string with spaces into a cell

From: Bruno Luong

Date: 4 May, 2012 06:36:18

Message: 2 of 2

regexp('% 90 Directions and 128 Frequencies', '\s+', 'split')

% Bruno

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us