After some thinking, why not send the value to be set with the function like this:
void SetElement(double value)
{
......
// Calculate x,y,z
doubleArray[x,y,z]=value;
}
and use it:
void func()
{
SetElement(5.0);
}
However, I will still choose one of your helpful answers...