help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reverse concatenation?


From: David Bateman
Subject: Re: Reverse concatenation?
Date: Thu, 12 Jun 2008 18:07:35 +0200
User-agent: Thunderbird 2.0.0.12 (X11/20080306)

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                                address@hidden
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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]