discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] create uniform PMT vector from python


From: Ben Reynwar
Subject: Re: [Discuss-gnuradio] create uniform PMT vector from python
Date: Thu, 11 Apr 2013 10:03:21 -0700

Great, thanks.  I'm only using it for QA code so setting the elements
one by one like you suggest will work fine.

On Thu, Apr 11, 2013 at 9:52 AM, Martin Luelf <address@hidden> wrote:
>> Hi all,
>>
>> Is there a way to create a uniform PMT vector from python?
>>
>> I can use, for example, 'pmt.make_c32vector(length, value)' to create
>> a vector where each element is 'value' but I don't see a way to modify
>> these values from python.
>>
>> If there isn't, are there any objections to overloading these
>> functions to take std::vectors as input so that we can pass in lists
>> from python?
>>
>> Cheers,
>> Ben
>
> Hi,
>
> I remember, I wasn't sure about the supposed way of doing that either for
> a u8vector. Finally I used the set method to set the individual elements
> like this:
> ------
> # elements as list
> values = (0xA1, ...)
>
> # create pmt vector with one default value for all elements
> pmtvector = pmt.pmt_make_u8vector(len(values), 0x00)
>
> # set the individual elements
> for i in xrange(len(values)) :
>         pmt.pmt_u8vector_set(pmtvector, i, values[i])
> ------
>
> Not nice, but it works for me. Although I agree that passing a list at
> construction would be very handy.
>
> Yours
> Martin
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio



reply via email to

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