How change a staticmesh material using Construction Script

I made a script that can change the static mesh in the editor. In this script caught the number of elements that have the static mesh and lists of materials applied per element. Except that I can not change the material that list. How can I do in order to change these materials?

you want to change only the materials or parameters inside each material?

Editor images

Hi Mhosse

The idea is to change the materials. Actually want to do more things that blueprint.

Thanks dude.

I go apply and than I post here the result.

Here is a solution