#!/usr/local/bin/perl # nrn2mat - take an nrn ascii file and make it sutable fo matlab open(I,"$ARGV[0]") || die "can't open input file"; @infile = ; chop(@infile); close I; $len= $infile[1]; $nlines = @infile; $nlines = ($nlines-1)/($len+1); #print STDERR $len; #@out = (1..$len); @out = (); for ($i=1;$i<$len+1;$i++) { for($j=0;$j<$nlines;$j++){ $out[$i-1] = $out[$i-1] . " $infile[$j*($len+1)+$i]"; } } shift(@out); open(O,">out.txt"); print O join("\n",@out); close O; exit; #if ($infile[0] =~ /PolyLines/) { # @lens = (); # $i=0; # while($lens[$i] < $#infile){ # $lens[$i]=$infile[$