I think you must have used $line = zeros(5) which replaces the
$line as a slice of $im with a clean 5-element array.  To do
elementwise assignment with pdls you need the =. assignment.

Cheers,
Chris

On Wed, Jul 20, 2011 at 10:42 AM, Vijayaraj <[email protected]> wrote:
> I am sorry, its working fine, I didt copy paste previously, somewhere I didt
> mistake when writing on myself. sorry..
>
> On Wed, Jul 20, 2011 at 4:39 PM, Chris Marshall <[email protected]>
> wrote:
>>
>> You did not attach the code you ran.  I cut-and-pasted the
>> below, edited out the prompt and changed p to print to get
>> this which appears to work fine.  Does this code work for
>> you?
>>
>> --Chris
>>
>> $ cat tv.pl
>> use PDL;
>>
>> $im= sequence(5,5);
>> $line = $im->slice(':,(2)');
>> $line .= zeroes(5);
>> $line++;
>> print "$im\n";
>> print "$line\n";
>>
>> $ perl tv.pl
>>
>> [
>>  [ 0  1  2  3  4]
>>  [ 5  6  7  8  9]
>>  [ 1  1  1  1  1]
>>  [15 16 17 18 19]
>>  [20 21 22 23 24]
>> ]
>>
>> [1 1 1 1 1]
>>
>> On Wed, Jul 20, 2011 at 10:14 AM, Vijayaraj <[email protected]> wrote:
>> > I am using the pdl version of
>> > vijay@vijay-VirtualBox:~/perl$ perldl -v
>> > perlDL shell v1.354
>> >
>> > here is the code for perlDL shell,
>> >
>> > pdl> $im= sequence (5,5)
>> > pdl> $line = $im->slice(':,(2)')
>> >  pdl> $line .= zeroes(5)
>> >  pdl> $line++
>> >  pdl> p $im
>> >
>> > [
>> >   [ 1  2  3  4  5]
>> >   [ 6  7  8  9 10]
>> >   [ 1  1  1  1  1]
>> >   [16 17 18 19 20]
>> >   [21 22 23 24 25]
>> >  ]
>> >
>> > pdl> print $line
>> >  [1 1 1 1 1]
>> >
>> > I used the same code with perl program and it does not change the 3rd
>> > row.
>> >
>> > Regards,
>> > Vijay.
>> >
>> > On Wed, Jul 20, 2011 at 3:53 PM, chm <[email protected]> wrote:
>> >>
>> >> On 7/20/2011 9:39 AM, Vijayaraj wrote:
>> >>>
>> >>> Hello PDL users,
>> >>>
>> >>> I am following the tutorial from this link,
>> >>> http://pdl.perl.org/?docs=Indexing&title=PDL::Indexing
>> >>> when I execute the pdl code from pdl>  environment, I can change the
>> >>> parent
>> >>> pdl by modifying the child pdl, and the same code with perl program
>> >>> does
>> >>> not
>> >>> change the parent pdl. is there any difference in executing the pdl
>> >>> code
>> >>> from pdl>  environment to perl normal programming code?
>> >>>
>> >>> Vijay.
>> >>
>> >> You'll have to give some more specific information:
>> >>
>> >> (1) Which PDL shell are you using pdl2 or perldl?
>> >> (2) An example from the shell that shows changing the parent
>> >> (3) An example with output from a program showing different
>> >>
>> >> I've found cutting and pasting perl code from a program
>> >> into a pdl2 session gives pretty much identical results.
>> >> perldl2 not so much as it does not have support for
>> >> lexical variables and a number of other features....
>> >>
>> >> You should also include the information on your PDL
>> >> install: the output from perldl -V has most of the
>> >> useful stuff.
>> >>
>> >> Cheers,
>> >> Chris
>> >
>> >
>> >
>> >
>
>
>
>

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to