QUOTE (michaelk @ Feb 27 2016, 11:20 AM)

No problem.

Sadly, my ability to extrapolate from the above example and previous has hit a wall. Using the form for the generated arrays, very nicely zeroed, I have tried use them to do a basic matrix subtraction:

temp1_$i[$j] = temp_$i[$j] - average[j]

where each of the above is a 1x8 matrix. For simplicity of debugging, I reduced i to run from 1 to 2. Using the strategy of redirecting matrix elements into temporary variables from the previous posts, I tried to conduct this loop as being

matrix(i,j)= variable 1 - variable 2

where temp_$i[$j]=variable 1 and average[j] is variable 2.

The problem I am finding is that, somehow, in my loop, my line where the subtraction occurs somehow REDUCES the dimensionality of the 1x8 matrix by one. I have tracked down the problem to be line

eval temp1_${i}[$j]=$( echo "scale=4; ${!test}-$var1" | bc )"

I left a few of my print statements, before and after, showing that this line is the cause of the problem. It goes from a 1x8 matrix, through all of the j index, to a 1x7, after an error of

(standard_in) 1: syntax error

This happens one more time as it runs through the do loops, resulting in a 1x6. Then the loop repeats over i, and this happens to all of the vectors in the i loop.

Is it clear what is wrong with the syntax of the above statement to define the matrix elements of temp1_${i}?

CODE:

for (( i=0; i<=$directory; i++ ))

do

for (( j=0; j<$helixmax; j++ ))

do

eval temp1_${i}[$j]=0

done

done

#

#

#

echo ""

#for (( i=1; i<=$directory; i++ ))

for (( i=1; i<=2; i++ ))

do

for (( j=0; j<=8; j++ ))

do

test=temp_$i[$j]

var1=${average[$j]}

echo "Vector 1 is, before the operation"

echo "${temp1_1[@]}"

eval temp1_${i}[$j]=$( echo "scale=4; ${!test}-$var1" | bc )

echo "Vector 1 is, after the operation"

echo "${temp1_1[@]}"

done

done

And let's just say that I've learned my lesson that, after this code, I am learning Python and just working in that from now on...I've debated stopping and restarting in Python, but this work has a somewhat urgent need for finishing.