help-octave
[Top][All Lists]
Advanced

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

Re: set array values from 3 vectors


From: Andy Buckle
Subject: Re: set array values from 3 vectors
Date: Tue, 30 Aug 2011 16:12:46 +0100

On 30 August 2011 11:25, carbonmetrics <address@hidden> wrote:
> I have a canvas=zeros(1000,365), in which 1000=number of projects and
> 365=days of the year,
> a startdate and an enddate vector, and a value vector.
>
> what i would like to do is to place the values [value vector] in the canvas
> array,
> where the indices are > startdate and < enddate.
>
> if the canvas would be a vector, and the value a scalar then
> 'canvas(startdate:enddate)=value' would do the job.
>
> I can't get it done doing a loop, but of course I would much rather
> vectorize the code.
>
> It looks like a frequent question, but I could not find anything on this,
> does anybody have an idea?
>
> Thanks!
> Henk

It's probably just me being slow. I don't quite get it.

Could you write a short script that is self-contained, and does what
you want? It can be slow and loopy. Then it is easier for anyone
trying to help. They can write vectorised versions and compare to your
reference implementation.

-- 
/* andy buckle */


reply via email to

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