A graph can only source data from worksheet cells. Chart SERIES formulas require cell ranges (or named ranges) as arguments. There is no other way to build a chart. You will have to write your matrix to a worksheet then use the first line of code you showed to build the graph from that range.
BTW you said x is a variable number but your example shows 9 hard-coded, so my example is also hard-coded.
where Sheet Name is the name of a worksheet that you arbitrarily pick to store the data. It can be hidden.
Bookmarks