# vector assignment question

Hi,
Is there a way in AnyBody to assign part of a matrix to another
vector.

In Matlab script it like

a = b(50:75)

so ‘a’ is 50th to the 75th elements of another vector called b.

Thanks
Shashank

Hi Shashank,

There is no such facility available yet, but we are expecting to
include it further in AnyBody.
You can still make this operation, but the script will be long for a
vector of this size. The solution is to pick the elements one by one.
For your example it will be like this:

AnyVector b = { “some 100 elements in there” };
AnyVector a = {b[49], b[50], b[51], “â€¦and so on untilâ€¦” b[74]};

Notice that first element is b[0] so 50th element is b[49] and 75th
element is b[74].

You can also define a general rule that you can use for different
situations by just changing the first element i and choosing the n
number you want (in this case n will be 25) :
AnyInt i = 49;
AnyVector a = {b[i], b[i+1], b[i+2], “â€¦untilâ€¦” b[i+n]};

Best regards,
Sylvain, AnyBody Support

— In anyscript@yahoogroups.com, “shashu_23” <shashankraina@…> wrote:
>
> Hi,
> Is there a way in AnyBody to assign part of a matrix to another
> vector.
>
> In Matlab script it like
>
> a = b(50:75)
>
> so ‘a’ is 50th to the 75th elements of another vector called b.
>
> Thanks
> Shashank
>

Thanks Sylvain.
— In anyscript@yahoogroups.com, “AnyBody Support” <support@…>
wrote:
>
> Hi Shashank,
>
> There is no such facility available yet, but we are expecting to
> include it further in AnyBody.
> You can still make this operation, but the script will be long for
a
> vector of this size. The solution is to pick the elements one by
one.
> For your example it will be like this:
>
> AnyVector b = { “some 100 elements in there” };
> AnyVector a = {b[49], b[50], b[51], “â€¦and so on untilâ€¦” b[74]};
>
> Notice that first element is b[0] so 50th element is b[49] and 75th
> element is b[74].
>
> You can also define a general rule that you can use for different
> situations by just changing the first element i and choosing the n
> number you want (in this case n will be 25) :
> AnyInt i = 49;
> AnyVector a = {b[i], b[i+1], b[i+2], “â€¦untilâ€¦” b[i+n]};
>
> Best regards,
> Sylvain, AnyBody Support
>
>
>
>
>
> — In anyscript@yahoogroups.com, “shashu_23” <shashankraina@>
wrote:
> >
> > Hi,
> > Is there a way in AnyBody to assign part of a matrix to another
> > vector.
> >
> > In Matlab script it like
> >
> > a = b(50:75)
> >
> > so ‘a’ is 50th to the 75th elements of another vector called b.
> >
> > Thanks
> > Shashank
> >
>