Sure.  The NiceSlice syntax in PDL is very similar to MatLab's slicing syntax.  
You want to use either:
        $a->($i,:)
or
        $a->slice("$i,:")
to specify the slice on the left hand side there.  You may be running into the 
difference between direct assignment and computed assignment.  PDL 
distinguishes between assignment to *create* a new PDL ("direct assignment") 
and assignment to *fill* an old PDL ("computed assignment").  If you want to 
put values into a slice you want the ".=" operator (computed assignment) 
instead of the "=" operator (direct assignment).

On Jan 2, 2013, at 7:56 AM, Lee Goddard <[email protected]> wrote:

> I have been using PDL for about four hours now, and have got stuck with the 
> following.
> 
> I havethe following from MATLAB:
> 
> fori=1:length(in)
>    s(i,:)=exp(-((in(i)-bin_locations).^2)/sigma);
>  end
> 
> 
> I am having problems finding out how to translate to PDL the left-hand side 
> of the assignment: s(i,:)
> 
> Please would somebody advise?
> 
> I looked at 'set' but it apparently only sets 'a single value inside a 
> piddle' [1]. It also says it has been superseded by slice, but that man page 
> says slice is used to 'extract a rectangular slice of a piddle, from a string 
> specifier.'[2]
> 
> Incidentally, is there a good book on PDL in general, or perhaps specifically 
> for MATLAB users?
> 
> Many thanks in anticipation
> Lee
> 
> [1] http://pdl.perl.org/PDLdocs/Core.html#set
> [2] http://pdl.perl.org/PDLdocs/Slices.html#slice
> 
> _______________________________________________
> 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