Hi Craig,

Thanks for the information. It worked out just fine :-). I just had one
another
question to ask on this same topic.

If there is an Nx3 matrix and another 3x3 matrix and if I wanted the last
three rows
of Nx3 to be replaced by 3x3 matrix, what would be the easiest way of doing
it ??

Specifying it like :

$M(:,-1) = $A(:,2)

isn't working out. It changes nothing. So if you could suggest how to do
this, it would
be great. Element by element replacement should work out, but it would be
nicer
if I could just replace the rows in one go.

thanks
Saurabh

On 5/24/07, Craig DeForest <[EMAIL PROTECTED]> wrote:

You need to say "use PDL::NiceSlice;" at the top of your script.  The
nice slicing syntax is implemented via a source filter (that
preprocesses your code before Perl ever gets to it).  The source
filter module must be included explicitly in each file of your program.

Cheers,
Craig


On May 23, 2007, at 2:11 PM, Saurabh Singhvi wrote:

> Hi all,
>
> how do I specify a row in perl code when using PDL??
>
> if $M is a 3x3 matrix and I write
>
> $M->(1)
>
> it should give 2nd column and if I write
>
> $M->(:,1)
>
> then it should give me the 2nd row, atleast that's how it works out
> in PDL
> however, it doesn't seem to be working.
>
> though perl is not giving any syntax errors, it doesn't work. I get
> an error saying
>
> Not a CODE reference at xyz line.
>
> Please tell me how I can use this operation in perl code.
>
> thanks
> Saurabh
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl


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

Reply via email to