Exporting in .mat file of Electric field

My aim is to export the Electric field of my simulation in a .mat file.
I am using the following code:

inputs = [em_sensor_extractor.Outputs["EM E(x,y,z,f0)"]]
matlab_exporter_2 = analysis.exporters.MatlabExporter(inputs=inputs)
matlab_exporter_2.FileName = u" export file name "
matlab_exporter_2.UpdateAttributes()
matlab_exporter_2.Update()
document.AllAlgorithms.Add(matlab_exporter_2)

I obtain Axis0,1,2 and Snapshot0 matrix with Nx3 dimensions as output

Does each of the Snapshot0 dimension contain the complex value of Ex,Ey,Ez ?

When i plot them in matlab and Sim4Life i do not observe the same magnitudes.
Is there any point that i am missing ?

Yes, Snapshot0 contains complex values.

Are the magnitudes different by a factor of sqrt(2) ? If so, perhaps you are mixing up absolute magnitude values with RMS values?
If it is instead the pattern that is different (e.g. when you plot a 2D slice of the data), it is possible that you are not "reshaping" the data properly. Can you provide more information on what you are doing and what you are seeing? (you can copy/paste screenshot onto the forum posts, I think)

I found the mistake. There was one pixel shift in the lines that i was comparing. The rest was correct.

Log in to reply