


{"id":235239,"date":"2022-09-14T16:02:53","date_gmt":"2022-09-14T16:02:53","guid":{"rendered":"\/forum\/forums\/topic\/saving-delta-of-two-field-profile-monitors\/"},"modified":"2022-09-14T16:02:53","modified_gmt":"2022-09-14T16:02:53","slug":"saving-delta-of-two-field-profile-monitors","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/saving-delta-of-two-field-profile-monitors\/","title":{"rendered":"Saving delta of two field profile monitors"},"content":{"rendered":"<p>Hello, I am attempting to write a script that takes two field profile monitors (exact same dimensions) and takes the point by point difference between the two. I then want to save this delta field profile as a .mat file, and import this field as an input for a second simulation. My script appears to work correctly when I call the image() function in the code, the issue is when I try to save this delta field. The saved .mat file just reverts back to one of the two original field monitors, which is not the desired result.<\/p>\n<p>The following is my code:<\/p>\n<pre><span style=\"font-size: 10pt\">matlabload(\"OutputMonitor_MMI.mat\");<\/span><br><br><span style=\"font-size: 10pt\">E3 = emeProfile.E;<\/span><br><br><span style=\"font-size: 10pt\">E3_x = emeProfile.Ex;<\/span><br><br><span style=\"font-size: 10pt\">E3_y = emeProfile.Ey;<\/span><br><br><span style=\"font-size: 10pt\">E3_z = emeProfile.Ez;<\/span><br><br><span style=\"font-size: 10pt\">x = emeProfile.x;<\/span><br><br><span style=\"font-size: 10pt\">y = emeProfile.y;<\/span><br><br><span style=\"font-size: 10pt\">z = emeProfile.z;<\/span><br><br><br><br><br><span style=\"font-size: 10pt\">matlabload(\"OutputMonitor_Ports.mat\");<\/span><br><br><span style=\"font-size: 10pt\">E4 = emeProfile.E;<\/span><br><br><span style=\"font-size: 10pt\">E4_x = emeProfile.Ex;<\/span><br><br><span style=\"font-size: 10pt\">E4_y = emeProfile.Ey;<\/span><br><br><span style=\"font-size: 10pt\">E4_z = emeProfile.Ez;<\/span><br><br><br><br><br><span style=\"font-size: 10pt\">DeltaTE1_Ex = E4_x - E3_x;<\/span><br><br><span style=\"font-size: 10pt\">DeltaTE1_Ey = E4_y - E3_y;<\/span><br><br><span style=\"font-size: 10pt\">DeltaTE1_Ez = E4_z - E3_z;<\/span><br><br><br><br><br><span style=\"font-size: 10pt\">DeltaMagTE1 = sqrt((DeltaTE1_Ex)^2+(DeltaTE1_Ey)^2+(DeltaTE1_Ez)^2);<\/span><br><br><br><br><br><span style=\"font-size: 10pt\">image(y,z,DeltaMagTE1); #correct field is displayed here<\/span><br><br><br><br><br><span style=\"font-size: 10pt\">EM = rectilineardataset(\"EM fields\",x,y,z);<\/span><br><br><span style=\"font-size: 10pt\">EM.addattribute(\"E\",DeltaTE1_Ex,DeltaTE1_Ey,DeltaTE1_Ez);<\/span><br><br><span style=\"font-size: 10pt\">matlabsave(\"TestingDeltaNew.mat\",EM); #the field saved here is not the same as the one in the image<\/span><\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"template":"","class_list":["post-235239","topic","type-topic","status-closed","hentry"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["262452","2592"],"_bbp_author_ip":["23.220.96.181"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["311"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["235239"],"_bbp_forum_id":["27833"],"_bbp_engagement":["2592","262452"],"_bbp_voice_count":["2"],"_bbp_reply_count":["3"],"_bbp_last_reply_id":["235393"],"_bbp_last_active_id":["235393"],"_bbp_last_active_time":["2022-09-15 17:04:30"]},"test":"kemackayciena-com"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/235239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/235239\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=235239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}