Create a matrix from a list of values?

Hello,

I’m sorry if this seems like a basic question, but I’ve been pulling my hair out trying to figure this out. I’m an infrequent PHPer at best, and that makes even simple stuff difficult

I have a list of values for each state… it looks like this

state1: .5
state2: .4
state3: .7

I want to go through and calculate absolute differences and plop those into a matrix (I have managed to already create that).

So it should look like this:

        state1    state2   state3

state1 0 .1 .2
state2 .1 0 .3
state3 .2 .3 0

Try as I might I’m coming up short on how to do this… can you think of an easy code to do it offhand?

Thanks!
Shane

Let’s see what you have so far. I’m not entirely clear on what needs to be done

Sponsor our Newsletter | Privacy Policy | Terms of Service