Help for this page

Select Code to Download


  1. or download this
    Matlab:
        load data.txt
        a=data;
    Perl:
        $a = supersplit_open( 'data.txt' ); #Without supersplit, it's more
    + code
    
  2. or download this
    Matlab:
        sum(a')
    Perl:
        $sum = map{ my $c = 0; map{ $c += $_; }@$_; $c; } @$a;
    
  3. or download this
    Matlab:
        sum(a)
    ...
        my $last = $#{$a->[0]};
        $sum = [ map {0} 0..$last ];
        map{ $sum->[$i] += $_->[$i] for my $i (0..$last) } @$a;
    
  4. or download this
    large=find( a(:,1) > 1E10 );
    large_ok = find( a(:,1) > 1E10 & a(:,3) > 0 );
    sum( a(large,:) )
    mean( a(large_ok,:) )
    
  5. or download this
    SELECT mean(a1), mean(a2), mean(a3), mean(a4), mean(a5)
     FROM a
     WHERE a1 > 1.0E10 and a3 > 0;
    
  6. or download this
    Matlab:
        for i=1:length(b)
    ...
    Perl:
        my $localsum = 0;
        $s = [ map{ $localsum += $_ } @$b ];