That solved my problem. I just had to introduce another temporary variable. So looks like "max" can be used to get the index as well as the maximum number but not straight into an array position, a temporay variable is needed.
Anyways to be truthful, I didn't try all the statements in Mathscript window, but I tried several of them. It would be good if while we run a VI containing Mathscript node, to get a list of errors instead of the error "Code could not be..........". Thanks for your support and sorry for being "partially true".