help-octave
[Top][All Lists]
Advanced

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

Re: building dynamic ranges from matrix


From: Kire Pudsje
Subject: Re: building dynamic ranges from matrix
Date: Tue, 28 Nov 2017 00:06:40 +0100



On Tue, Nov 21, 2017 at 6:45 PM, AG <address@hidden> wrote:

Here is my problem.

Given a N X 2 matric, build a single vector that contains the range of
numbers between (:,1) and (:,2).
For example:

range_start_end = [1,5 ; 4 7];
should produce a vector containing [1:5,2:4],  The final result being
[1,2,3,4,5,4,5,6,7].  I am trying to do this with just simple matrix
operation if possible- no if's then's array functions etc.

I have tried this a few ways but can't seem to get it to work.. so I'd love
to hear any ideas.
-Much appreciated!


a={[1,5],[4,7]};
cell2mat(cellfun(@(c) c(1):c(2),a,'UniformOutput',false))


reply via email to

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