It is possible to use a custom field profile from a .mat file as the source in an EME simulation. The field profile data can either be from another simulation, or defined from an equation in the script.
The script below generates a field profile and saves it into a .mat file.
# define position vectors
x = 0;
y = linspace(-2e-6,2e-6,100);
z = linspace(-1.5e-6,1.5e-6,101);
X = meshgrid3dx(x,y,z);
Y = meshgrid3dy(x,y,z);
Z = meshgrid3dz(x,y,z);
# define field profile to import
Ex = 0*X;
Ey = exp( - (Y/1e-6)^2 - (Z/1e-6)^2 );
Ez = 0*X;
Hx = 0*X;
Hy = 0*X;
Hz = sqrt(eps0/mu0)*Ey;
# create dataset
EM = rectilineardataset("EM fields",x,y,z);
# save dataset to .mat file which can be imported
To set this as a port mode, open the Edit EME port tab, select "user import" under mode selection and click on "Import Fields".
To verify that the desired mode has been imported properly, right click on the port in the object tree and select Visualize -> Fields.