Not sure why you want to implement the code in simulink. But what you want to do can be implemented in matlab script, then maybe you can call this script in simulink.
If your weigjht means the excitation voltage of each element.
obj = linearArray('Element',yourElement);
obj.AmplitudeTaper = [your value].
patternAz(obj,frequency);
if you have a custom antenna pattern, then you can use phased array toolbox functionalities to synthesis your array pattern.