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

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Priya
on 17 Apr 2013

My cell array (1 X 11) is as follows:

a = {'A','B','C',';','D','E','F',';','1','2','3'}

Each character

I want a matlab program to recognize ';'(semicolon) as delimiter and whatever follows it comes to next row.

Desired output is a cell array of order 3 X 3

{ 'A','B','C'

'D','E','F'

'1','2','3' }

*No products are associated with this question.*

Answer by Jan Simon
on 17 Apr 2013

Accepted answer

a = {'A','B','C',';','D','E','F',';','1','2','3'}; sep = find(strcmp(a, ';')); b = a; b(sep) = []; b = transpose(reshape(b, sep(1) - 1), []);

Priya
on 17 Apr 2013

Hi Jan

It worked perfectly..

b = transpose(reshape(b, sep(1) - 1), [ ]);

But I did not understand the last line syntax. What does [ ] denotes ?

## 0 Comments