Appendix D : Computer Code
[Return to Text]
#!/usr/bin/perl
#################################################
# #
# Program 1 #
# #
# This program parses the ABAQUS *.DAT files. #
# It will extract all the information needed #
# to generate the tactile images, tactile maps, #
# and other 'output' parameters. The output of #
# this program is several files containing #
# these output parameters. The files can be #
# read and further analyzed in Excel. #
# #
#################################################
# Node 3289 is top center of tissue.
# Node 723 is upper left corner of probe.
# Node 768 is bottom center of probe.
# Node 813 is upper right corner of probe.
$makealldata = 1;
&reset_alldata;
# List all the models you want to analyze:
makemap("d10h08e10f10");
makemap("d10h12e10f10");
makemap("d10h16e10f10");
makemap("d10h20e10f10");
print "Finished.\n\n";
###############################################
# #
# Below are the subroutines for this program. #
# #
###############################################
sub makemap {
$filename = $_[0];
print "Loading $filename\n";
if ($filename =~ /d(..)h(..)e/) {
$dd = $1;
$hh = $2;
$dd =~ s/\A0//;
$hh =~ s/\A0//;
$dd = $dd/10.0;
$hh = $hh/10.0;
$tissuetop = 5.0 - (1.2 + $dd/2.0 + $dd*$hh);
#print "$tissuetop * $dd * $hh * $1 * $2 *\n";
}
open(FILE,"$filename.dat");
@LINES = ;
close(FILE);
open(FILE,">A$filename.txt");
print "Analyzing $filename\n";
$statstring = ",,,MAX,,,,PROBE\nSTEP,,NODE,X,CPRESS,,X,Y,TPRESS\n";
$probestring = ",";
$steps = 0;
$findnodes = 0;
$instep = 0;
$maxrank = 0;
%NODEX = ();
%NODEY = ();
%CNODE = ();
%CPRESS = ();
@timage2cpress = ();
@timage2n = ();
@timageprobe = ();
@timagex = ();
@timagecpress = ();
@maxpress_step = ();
@probey_step = ();
%tot = ();
%avg = ();
%avg2 = ();
%avg3 = ();
%avg4 = ();
%avg5 = ();
%avg6 = ();
%avg7 = ();
%slotp = ();
%slotp2 = ();
%slotp3 = ();
%slotp4 = ();
%slotp5 = ();
%slotp6 = ();
%slotp7 = ();
%slotn = ();
%slotn2 = ();
%slotn3 = ();
%slotn4 = ();
%slotn5 = ();
%slotn6 = ();
%slotn7 = ();
%nodestring = ();
for ($ii = 0; $ii < @LINES; $ii++) {
if ($findnodes == 0) {
if ($LINES[$ii] =~ /NODE, NSET=GLOBAL/i) {
$findnodes = 1;
}
} elsif ($findnodes == 1) {
if ($LINES[$ii] =~ /ELEMENT/i) {
$findnodes = 2;
} else {
$LINES[$ii] =~ s/LINE......//i;
$LINES[$ii] =~ s/\A\s*?(\S+?),\s*?(\S+?),\s*?(\S+?),(\s|\S)*\Z/$1,$2/;
$NODEX{$1} = $2;
$NODEY{$1} = $3;
}
} elsif ($instep==0) {
if ($LINES[$ii] =~ /S\s\sCPRESS/) {
$instep = 1;
$PROBEY = 0;
%CPRESS = ();
%NODEU1 = ();
%NODEU2 = ();
%NODEUX = ();
%NODEUY = ();
$incontact = 1;
}
} else {
if ($incontact == 1) {
if ($LINES[$ii] =~ /\s(\S+?)\s\sCL\s\s\s(\S+?)\s/i) {
$CPRESS{$1} = $2;
$CNODE{$1} = 1;
} elsif ($LINES[$ii] =~ /NODE\sFOOT-\s\s\sU/) {
$incontact = 0;
}
} else {
if ($LINES[$ii] =~ /MAXIMUM/) {
$instep = 0;
&print_step;
} elsif ($LINES[$ii] =~ /\s(\S+?)\s+?(\S+?)\s+?(\S+?)(\s|\Z)/) {
if ($1 == '723') {
#$PROBEX = $NODEX{'768'} + $2 - $NODEX{'3289'};
$PROBEX = $2;
$PROBEY += ($3 + $tissuetop)/2.0;
} elsif ($1 == '768') {
$PROBECX = $2;
$PROBECY = $3 + $tissuetop;
} elsif ($1 == '813') {
$PROBEY += ($3 + $tissuetop)/2.0;
} elsif ($CPRESS{$1} > 0) {
$NODEU1{$1} = $2;
$NODEU2{$1} = $3;
$NODEUX{$1} = $NODEX{$1} + $2;
$NODEUY{$1} = $NODEY{$1} + $3;
}
}
}
}
}
close(FILE);
&print_excel_file;
}
##################################
sub print_step {
print FILE "### Probe (X,Y,CX,CY) = ($PROBEX,$PROBEY,$PROBECX,$PROBECY) ###\n";
foreach $nodeid (sort sortbyux keys %CPRESS) {
print FILE "$nodeid,$NODEUX{$nodeid},$CPRESS{$nodeid},$steps,$NODEUX{$nodeid},$NODEUY{$nodeid},$NODEU1{$nodeid},$NODEU2{$nodeid}\n";
#print FILE "$nodeid,$NODEUX{$nodeid},$NODEU2{$nodeid},$CPRESS{$nodeid},$NODEUY{$nodeid},$NODEU1{$nodeid}\n";
}
$px = int((1000*$PROBEX)+0.001);
if ( ($px < 3000) && ($px >= 0) && (($px % 200) == 0) ) {
$steps++;
$maxpress = 0;
$tpress = 0;
$noderank = 0;
foreach $nodeid (sort sortbyux keys %CPRESS) {
$noderank++;
$timageprobe[$steps] = $PROBEX;
$timagex[$steps][$noderank] = $NODEUX{$nodeid};
$timagecpress[$steps][$noderank] = $CPRESS{$nodeid};
if ($NODEUX{$nodeid} >= 0) {
$roundx = int($NODEUX{$nodeid}*10 + 0.5) + 50;
} else {
$roundx = int($NODEUX{$nodeid}*10 - 0.5) + 50;
}
if (abs(($roundx-50)/10 - $PROBEX) <= 0.8 + 10) {
$timage2cpress[$steps][$roundx] += $CPRESS{$nodeid};
$timage2n[$steps][$roundx] += 1;
}
$tpress += $CPRESS{$nodeid};
if ($CPRESS{$nodeid} > $maxpress) {
$maxpress = $CPRESS{$nodeid};
$maxpressID = $nodeid;
}
}
if ($noderank > $maxrank) {$maxrank = $noderank;}
$statstring .= "$steps,,$maxpressID,$NODEUX{$maxpressID},$maxpress,,$PROBEX,$PROBEY,$tpress\n";
$maxpress_step[$steps] = $maxpress;
$probey_step[$steps] = $PROBEY;
$probestring .= ",$PROBEX";
foreach $nodeid (keys %CNODE) {
if ($nodestring{$nodeid} == "") {
$nodestring{$nodeid} = "$nodeid,$NODEX{$nodeid}";
for ($jj = 1; $jj < $steps; $jj++) {
$nodestring{$nodeid} .= ",0";
}
}
if ($CPRESS{$nodeid} > 0) {
$nodestring{$nodeid} .= ",$CPRESS{$nodeid}";
} else {
$nodestring{$nodeid} .= ",0";
}
}
foreach $nodeid (keys %CPRESS) {
if ($NODEUX{$nodeid} >= 0) {
$dx = int($NODEUX{$nodeid} * 10 + 0.5) * 100;
$dx2 = int($NODEUX{$nodeid} * 1000 + 0.5);
} else {
$dx = int($NODEUX{$nodeid} * 10 - 0.5) * 100;
$dx2 = int($NODEUX{$nodeid} * 1000 - 0.5);
}
#$dx = int(($NODEUX{$nodeid} + 0.1)/2*10)*2;
if ($px < 1) {
$slot_p = $CPRESS{$nodeid}/2;
$slot_n = 0.5;
} else {
$slot_p = $CPRESS{$nodeid};
$slot_n = 1;
#if ($dx == 0) {$slot_n = 0.5;}
}
$lim = 2000;
if ((abs($px - $dx) <= 800) && (abs($dx) <= $lim)) {
$slotp{$dx} += $slot_p;
$slotn{$dx} += $slot_n;
$slotp{-$dx} += $slot_p;
$slotn{-$dx} += $slot_n;
}
if ((abs($px - $dx) <= 100) && (abs($dx) <= $lim)) {
$slotp2{$dx} += $slot_p;
$slotn2{$dx} += $slot_n;
$slotp2{-$dx} += $slot_p;
$slotn2{-$dx} += $slot_n;
}
$tol = 100;
if ((abs($px - $dx2) <= $tol) && (abs($dx) <= $lim)) {
$slotp3{$dx} += $slot_p;
$slotn3{$dx} += $slot_n;
if ($dx != 0) {
$slotp3{-$dx} += $slot_p;
$slotn3{-$dx} += $slot_n;
}
}
if ((abs($px - ($dx2 - 200)) <= $tol) && (abs($dx) <= $lim)) {$slotp4{$dx} += $slot_p;$slotn4{$dx} += $slot_n;}
if ((abs($px - ($dx2 + 200)) <= $tol) && (abs($dx) <= $lim)) {$slotp4{-$dx} += $slot_p;$slotn4{-$dx} += $slot_n;}
if ((abs($px - ($dx2 - 400)) <= $tol) && (abs($dx) <= $lim)) {$slotp5{$dx} += $slot_p;$slotn5{$dx} += $slot_n;}
if ((abs($px - ($dx2 + 400)) <= $tol) && (abs($dx) <= $lim)) {$slotp5{-$dx} += $slot_p;$slotn5{-$dx} += $slot_n;}
if ((abs($px - ($dx2 - 600)) <= $tol) && (abs($dx) <= $lim)) {$slotp6{$dx} += $slot_p;$slotn6{$dx} += $slot_n;}
if ((abs($px - ($dx2 + 600)) <= $tol) && (abs($dx) <= $lim)) {$slotp6{-$dx} += $slot_p;$slotn6{-$dx} += $slot_n;}
if ((abs($px - ($dx2 - 800)) <= $tol) && (abs($dx) <= $lim)) {$slotp7{$dx} += $slot_p;$slotn7{$dx} += $slot_n;}
if ((abs($px - ($dx2 + 800)) <= $tol) && (abs($dx) <= $lim)) {$slotp7{-$dx} += $slot_p;$slotn7{-$dx} += $slot_n;}
}
}
}
sub print_excel_file {
open(FILE,,">B$filename.txt");
print FILE "$probestring\n";
foreach $nodeid (sort sortbyx keys %nodestring) {
print FILE "$nodestring{$nodeid}\n";
}
close(FILE);
open(FILE,,">C$filename.txt");
foreach $slot (sort sortbyn keys %slotn) {
$avg{$slot} = $slotp{$slot} / ($slotn{$slot}+0.00001);
$avg2{$slot} = $slotp2{$slot} / ($slotn2{$slot}+0.00001);
$avg3{$slot} = $slotp3{$slot} / ($slotn3{$slot}+0.00001);
$avg4{$slot} = $slotp4{$slot} / ($slotn4{$slot}+0.00001);
$avg5{$slot} = $slotp5{$slot} / ($slotn5{$slot}+0.00001);
$avg6{$slot} = $slotp6{$slot} / ($slotn6{$slot}+0.00001);
$avg7{$slot} = $slotp7{$slot} / ($slotn7{$slot}+0.00001);
}
foreach $slot (sort sortbyn keys %slotn) {
$tot{$slot} = $avg3{$slot} + $avg4{$slot} + $avg5{$slot} + $avg6{$slot} + $avg7{$slot};
$tot{$slot} = $tot{$slot} + $avg4{-$slot} + $avg5{-$slot} + $avg6{-$slot} + $avg7{-$slot};
$tot{$slot} = $tot{$slot} / 9;
}
foreach $slot (sort sortbyn keys %slotn) {
$pos = $slot / 1000;
#print FILE "$pos,$avg,$slotp{$slot},$slotn{$slot}\n";
print FILE "$pos,$tot{$slot}";
print FILE ",,$pos,$avg{$slot}";
print FILE ",,$pos,$avg7{-$slot},$avg6{-$slot},$avg5{-$slot},$avg4{-$slot},$avg3{$slot},$avg4{$slot},$avg5{$slot},$avg6{$slot},$avg7{$slot}\n";
}
print FILE "\n\n";
print FILE "$statstring\n";
close(FILE);
if ($makealldata == 1) {
open(FILE,'>>alldata1.txt');
print FILE "$filename,";
for ($ii=-2000;$ii<=2000;$ii+=100) {
print FILE "$tot{$ii},";
}
print FILE "\n";
close(FILE);
open(FILE,'>>alldata2.txt');
print FILE "$filename,";
for ($ii=1;$ii<=15;$ii++) {
print FILE "$maxpress_step[$ii],";
}
print FILE ",$filename,";
for ($ii=1;$ii<=15;$ii++) {
print FILE "$probey_step[$ii],";
}
print FILE "\n";
close(FILE);
}
open(FILE,,">D$filename.txt");
for ($ii = $steps; $ii >= 1; $ii--) {
print FILE "PROBEX,$timageprobe[$ii],,";
}
print FILE "\n\n";
for ($ii = $steps; $ii >= 1; $ii--) {
print FILE "X,CPRESS,,";
}
print FILE "\n";
for ($ii = 1; $ii <= $maxrank; $ii++) {
for ($jj = $steps; $jj >= 1; $jj--) {
print FILE "$timagex[$jj][$ii],$timagecpress[$jj][$ii],,";
}
print FILE "\n";
}
close(FILE);
open(FILE,,">E$filename.txt");
print FILE ",";
for ($ii = $steps; $ii >= 1; $ii--) {
print FILE "$timageprobe[$ii],";
}
print FILE "\n\n";
for ($ii = 0; $ii <= 100; $ii++) {
$loc = ($ii - 50)/10;
print FILE "$loc,";
for ($jj = $steps; $jj >= 1; $jj--) {
$temppress = $timage2cpress[$jj][$ii] / ($timage2n[$jj][$ii] + 0.0001);
if ($temppress == 0) {$temppress = "";}
print FILE "$temppress,";
}
print FILE "\n";
}
close(FILE);
}
sub sortbyux {
$NODEUX{$a} <=> $NODEUX{$b}
or
$a cmp $b;
}
sub sortbyx {
$NODEX{$a} <=> $NODEX{$b}
or
$a cmp $b;
}
sub sortbyn {
$a <=> $b
or
$a cmp $b;
}
#########################################
sub reset_alldata {
open(FILE,'>alldata1.txt');
print FILE ",";
for ($ii=-20;$ii<=20;$ii++) {
print FILE ($ii / 10);
print FILE ",";
}
print FILE "\n";
close(FILE);
open(FILE,'>alldata2.txt');
print FILE ",";
for ($ii=1;$ii<=15;$ii++) {
$jj = (30 - $ii*2)/10.0;
print FILE "$jj,";
}
print FILE ",,";
for ($ii=1;$ii<=15;$ii++) {
$jj = (30 - $ii*2)/10.0;
print FILE "$jj,";
}
print FILE "\n";
close(FILE);
}
#!/usr/bin/perl
###############################################
# #
# Program 2 #
# #
# This program reads the output files of the #
# first program and creates tactile maps with #
# compensation for the Curvature of tactile #
# images due to the shape of the probe. #
# #
###############################################
$makealldata = 1;
$nummaps = -1;
# List all the models you want to analyze:
makemap("d10h08e10f10");
makemap("d10h12e10f10");
makemap("d10h16e10f10");
makemap("d10h20e10f10");
&makealldata;
print "Finished.\n\n";
###############################################
# #
# Below are the subroutines for this program. #
# #
###############################################
sub makemap {
$filename = $_[0];
print "Converting $filename\n";
open(FILE,"D$filename.txt");
@LINES = ;
close(FILE);
$nummaps++;
$mapname[$nummaps] = $filename;
@cpress = ();
@cpressn = ();
@cpbase = ();
@cpadjust = ();
@cpress2 = ();
@cpress3 = ();
for ($ii = 3; $ii < @LINES; $ii++) {
$theline = $LINES[$ii];
for ($jj = 0; $jj <= 28; $jj += 2) {
if ($theline =~ s/\A(.*?),(.*?),,//) {
$useit = $1;
$ds = $1 * 1.0 - 0.1 * $jj;
$cp = $2 * 1.0;
if ($ds >= 0) {
$ds = int($ds*5+0.5) + 50;
} else {
$ds = int($ds*5-0.5) + 50;
}
if ($useit != "") {
$cpress[$jj][$ds] += $cp;
$cpressn[$jj][$ds]++;
}
}
}
}
for ($ii = 0; $ii <= 28; $ii += 2) {
for ($jj = 0; $jj <= 100; $jj++) {
if ($cpressn[$ii][$jj] > 0) {
$cpress[$ii][$jj] = $cpress[$ii][$jj] / $cpressn[$ii][$jj];
}
}
}
if ($filename =~ /f(..)/) {
$totalforce = $1 / 10.0;
}
for ($ii = 0; $ii <= 100; $ii++) {
for ($jj = 20; $jj <= 28; $jj += 2) {
$cpbase[$ii] += $cpress[$jj][$ii];
}
$cpbase[$ii] = $cpbase[$ii] / 5.0;
}
$avgpress = 0;
for ($ii = 46; $ii <= 54; $ii++) {
$avgpress += $cpbase[$ii];
}
$avgpress = $avgpress / 9.0;
for ($ii = 0; $ii <= 100; $ii++) {
if ($cpbase[$ii] > 0) {
$cpadjust[$ii] = (0.351951508 * $totalforce) / ($cpbase[$ii] * 1.0);
} else {
$cpadjust[$ii] = 0;
}
}
for ($ii = 0; $ii <= 28; $ii += 2) {
for ($jj = 0; $jj <= 100; $jj++) {
if ($cpressn[$ii][$jj] > 0) {
$cpress2[$ii][$jj] = $cpress[$ii][$jj] * $cpadjust[$jj];
}
}
}
for ($ii = 51; $ii <= 100; $ii++) {
$cpress2[0][$ii] = ($cpress2[0][$ii] + $cpress2[0][100-$ii])/2.0;
$cpress2[0][100-$ii] = $cpress2[0][$ii];
}
for ($ii = 0; $ii <= 4; $ii++) {
for ($jj = -10; $jj < $ii; $jj++) {
$cpress3[4+$ii][10+$jj] = $cpress2[($ii-$jj)*2][50-$ii];
$cpress3[4-$ii][10-$jj] = $cpress2[($ii-$jj)*2][50-$ii];
}
for ($jj = $ii; $jj <= 10; $jj++) {
$cpress3[4+$ii][10+$jj] = $cpress2[($jj-$ii)*2][50+$ii];
$cpress3[4-$ii][10-$jj] = $cpress2[($jj-$ii)*2][50+$ii];
}
}
#####
open(FILE,">F$filename.txt");
if (1 == 1) {
for ($ii = 0; $ii <= 28; $ii += 2) {
print FILE "PROBEX," . ($ii/10.0) . ",,,";
}
print FILE "\n\n";
for ($ii = 0; $ii <= 28; $ii += 2) {
print FILE "X,CPRESS,,,";
}
print FILE "\n";
for ($jj = 40; $jj <= 60; $jj++) {
for ($ii = 0; $ii <= 28; $ii += 2) {
if ($cpressn[$ii][$jj] > 0) {
print FILE (($jj-50)/5.0) . ",$cpress[$ii][$jj],$cpress2[$ii][$jj],$cpressn[$ii][$jj],"
} else {
print FILE (($jj-50)/5.0) . ",,,,"
}
}
print FILE ",$cpbase[$jj],\n";
}
print FILE "\n\n";
}
print FILE "X,MAP,,X";
for ($ii = 0; $ii <= 8; $ii++) {
print FILE "," . (($ii - 4)/5.0);
}
print FILE "\n";
for ($jj = 0; $jj <= 20; $jj++) {
$map = 0;
for ($ii = 0; $ii <= 8; $ii++) {
$map += $cpress3[$ii][$jj];
}
$map = $map / 9.0;
print FILE (($jj - 10)/5.0) . ",$map,," . (($jj - 10)/5.0);
for ($ii = 0; $ii <= 8; $ii++) {
print FILE ",$cpress3[$ii][$jj]";
}
print FILE "\n";
$tactilemap[$nummaps][$jj] = $map;
$avgmappress[$nummaps] = $avgpress;
}
$thecpbase1[$nummaps] = $cpbase[50];
$thecpbase2[$nummaps] = ($cpbase[46] + $cpbase[54])/(2.0);
$thecpadj1[$nummaps] = $cpadjust[50];
$thecpadj2[$nummaps] = ($cpadjust[46] + $cpadjust[54])/(2.0);
print FILE "\nAVGCP,$avgpress\n";
print FILE "CPBASE1,$cpbase[50]\n";
print FILE "CPBASE2," . ($cpbase[46] + $cpbase[54])/(2.0) . "\n";
print FILE "CPADJ1,$cpadjust[50]\n";
print FILE "CPADJ2," . ($cpadjust[46] + $cpadjust[54])/(2.0) . "\n";
close(FILE);
}
################################
sub makealldata {
open(FILE,'>alldata3.txt');
print FILE "X";
for ($ii = 0; $ii <= $nummaps; $ii++) {
print FILE ",$mapname[$ii]";
}
print FILE "\n";
for ($ii = 0; $ii <= 20; $ii++) {
print FILE (($ii - 10)/5.0);
for ($jj = 0; $jj <= $nummaps; $jj++) {
print FILE ",$tactilemap[$jj][$ii]";
}
print FILE "\n";
}
print FILE "\nAVGCP";
for ($ii = 0; $ii <= $nummaps; $ii++) {
print FILE ",$avgmappress[$ii]";
}
print FILE "\n";
print FILE "CPBASE1";
for ($ii = 0; $ii <= $nummaps; $ii++) {
print FILE ",$thecpbase1[$ii]";
}
print FILE "\n";
print FILE "CPBASE2";
for ($ii = 0; $ii <= $nummaps; $ii++) {
print FILE ",$thecpbase2[$ii]";
}
print FILE "\n";
print FILE "CPADJ1";
for ($ii = 0; $ii <= $nummaps; $ii++) {
print FILE ",$thecpadj1[$ii]";
}
print FILE "\n";
print FILE "CPADJ2";
for ($ii = 0; $ii <= $nummaps; $ii++) {
print FILE ",$thecpadj2[$ii]";
}
print FILE "\n";
close(FILE);
}
#!/usr/bin/perl
################################################
# #
# Program 3 #
# #
# This program reads the output files of the #
# first program and extracts the output values #
# related to Tactile Image Pressure 'Jump'. #
# #
################################################
$cfiles = 0;
$dir = `dir /w C*`;
@dirLines = split('\n',$dir);
for ($ii = 0; $ii < @dirLines; $ii++) {
if ($dirLines[$ii] =~ /\AC/) {
@tempcfiles = split('\s+',$dirLines[$ii]);
for ($jj = 0; $jj < @tempcfiles; $jj++) {
$filename[$cfiles] = @tempcfiles[$jj];
$filename[$cfiles] =~ s/\.txt//i;
$filename[$cfiles] =~ s/\AC//i;
$cfiles++;
}
}
}
$filenum = 0;
open(FILE,'>alldata4.txt');
for ($ii = 0; $ii < $cfiles; $ii++) {
$pos = 0;
print FILE "$filename[$ii]\n";
print FILE "ProbeX,X,CPress,Y,TPress\n";
open(FILE2,"C$filename[$ii].txt");
@LINES = ;
close(FILE2);
foreach $line (@LINES) {
if ($line =~ /(\S|\S\S),,(\S+?),(\S+?),(\S+?),,(\S\.\S+?),(\S+?),(\S+?)\Z/) {
print FILE "$5,$3,$4,$6,$7\n";
$tmX[$filenum][$pos] = $3;
$tmCPress[$filenum][$pos] = $4;
$tmY[$filenum][$pos] = $6;
$tmTPress[$filenum][$pos] = $7;
$pos++;
}
}
$filenum++;
print FILE "\n";
}
print FILE "X";
for ($ii = 0; $ii < $cfiles; $ii++) {
print FILE ",$filename[$ii]";
}
print FILE "\n";
for ($ii = 0; $ii <= 14; $ii++) {
print FILE (2.8-$ii/5.0);
for ($jj = 0; $jj < $cfiles; $jj++) {
print FILE ",$tmY[$jj][$ii]";
}
print FILE "\n";
}
print FILE "\n";
for ($ii = 0; $ii < $cfiles; $ii++) {
$biggestval = 0;
$biggestloc = 3;
for ($jj = 4; $jj <= 14; $jj++) {
$thisval = $tmX[$ii][$jj-1]*1-$tmX[$ii][$jj]*1;
if ($thisval > $biggestval) {
$biggestval = $thisval;
$biggestloc = 2.8-$jj/5.0;
$biggestlocx = $tmX[$ii][$jj]*1;
}
}
$tmBVal[$ii] = $biggestval;
$tmBLoc[$ii] = $biggestloc;
$tmBLocX[$ii] = $biggestlocx;
}
for ($ii = 0; $ii < $cfiles; $ii++) {
print FILE ",$filename[$ii]";
}
print FILE "\nX";
for ($ii = 0; $ii < $cfiles; $ii++) {
print FILE ",$tmBLoc[$ii]";
}
print FILE "\nDist";
for ($ii = 0; $ii < $cfiles; $ii++) {
print FILE ",$tmBVal[$ii]";
}
print FILE "\nX*";
for ($ii = 0; $ii < $cfiles; $ii++) {
print FILE ",$tmBLocX[$ii]";
}
print FILE "\n\n";
close(FILE);
##### END OF CODE #####