Reverse concatenation?

David Bateman David.Bateman at motorola.com
Thu Jun 12 11:07:35 CDT 2008


Emily Moberg wrote:
> Sorry! So, if i have a matrix like this A=[6;1;2;3;4;6;3;3;3;6] I
> would like to be able to access the values between the 6's as matrices
> on their own, so B=[1;2;3;4], C=[3;3;3]. I'm a really new user to
> octave so I really have no idea if this is even possible.  Thanks so
> much for your time.

idx = find(A == 6);
B =eval(["{" sprintf("A(%d:%d) ",[idx(1:end-1)+1, idx(2:end)-1]'),"}"])

Creates a cell array with the values you want

D.


-- 
David Bateman                                David.Bateman at motorola.com
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



More information about the Help-octave mailing list