This is a great idea! It would make writing (and reading) tests so much easier.
Maggie On Fri, Apr 16, 2010 at 11:18 PM, Chris Marshall <[email protected]> wrote: > An idea I had from working some of the PDL::Matlab > features was supporting a string argument to pdl > which would evaluate the input data according to > matlab rules, so: > > $a = pdl <<EOPDL; > [ > [1 0 8] > [6 3 5] > [3 0 5] > [2 4 2] > ] > EOPDL > > would be one way to do this. The nice thing about > this extension is that it could be done without > breaking existing code (I think) and it would support > better interoperability with Matlab and Octave as > well as easier cut-and-paste of examples. > > --Chris > > On 4/16/2010 4:48 PM, Doug Hunt wrote: > > Hi Derek: I think setting $PDL::use_commas=1 might help. This will > > insert commas when printing the PDL, allowing it to be cut and pasted > more > > easily: > > > > perldl> $PDL::use_commas=1 > > perldl> p ones(10,10) > > > > [ > > [1,1,1,1,1,1,1,1,1,1], > > [1,1,1,1,1,1,1,1,1,1], > > [1,1,1,1,1,1,1,1,1,1], > > [1,1,1,1,1,1,1,1,1,1], > > [1,1,1,1,1,1,1,1,1,1], > > [1,1,1,1,1,1,1,1,1,1], > > [1,1,1,1,1,1,1,1,1,1], > > [1,1,1,1,1,1,1,1,1,1], > > [1,1,1,1,1,1,1,1,1,1], > > [1,1,1,1,1,1,1,1,1,1] > > ] > > > > --Doug > > > > [email protected] > > Software Engineer > > UCAR - COSMIC, Tel. (303) 497-2611 > > > > On Fri, 16 Apr 2010, Derek Lamb wrote: > > > >> I'm playing with the data from earlier today, the piddle: > >> > >> [ > >> [1 0 8] > >> [6 3 5] > >> [3 0 5] > >> [2 4 2] > >> ] > >> > >> > >> Trying to get it into a piddle by copying and pasting the output from > >> the email. Starting with a simple 1D case: > >> > >> perldl> print pdl(1,0,8) #print the piddle > >> [1 0 8] > >> perldl> p pdl([1 0 8]) #use printed output to make new piddle > >> Number found where operator expected at (eval 179) line 4, near "1 0" > >> (Missing operator before 0?) > >> Number found where operator expected at (eval 179) line 4, near "0 8" > >> (Missing operator before 8?) > >> syntax error at (eval 179) line 4, near "1 0" > >> > >> > >> > >> OK, fine, I need some quotes: > >> > >> perldl> p pdl qw[1 0 8] > >> [1 0 8] > >> > >> > >> But how to do the 2D case? About the closest I can get is this: > >> > >> perldl> p pdl qw[ > >> ..[> [1 0 8] > >> ..[> [6 3 5] > >> ..[> [3 0 5] > >> ..[> [2 4 2] > >> ..[> ] > >> [0 0 8 0 3 5 0 0 5 0 4 2] > >> > >> > >> It comes out 1D, and the first column is all zeroes. Any tricks for > >> making it come out 2D, or any ideas why the first column is all zeroes? > >> > >> cheers, > >> Derek > > _______________________________________________ > 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
