Dynamically Change Matrix Quantity

I'm using this code to dynamically create labels for my matrix. However, if the quantity changes, I can't set the matrix quantity dynamically. I've tried props.quantity but that was a guess.

JS{{

var json = JSON.parse(@{txtEffectConfig})

const effectsArray = json.C.split(',');
var props = {}
props.label = effectsArray[$]

return props
}}

Something like this in the quantity property could do the trick:

JS{
var json = JSON.parse(@{txtEffectConfig})

const effectsArray = json.C.split(',');

return effectsArray.length
}

Worked a charm!