


{"id":355434,"date":"2024-03-05T16:52:18","date_gmt":"2024-03-05T16:52:18","guid":{"rendered":"\/forum\/forums\/topic\/exporting-a-large-number-of-data-sets-into-txt-from-varfdtd\/"},"modified":"2024-03-05T16:52:18","modified_gmt":"2024-03-05T16:52:18","slug":"exporting-a-large-number-of-data-sets-into-txt-from-varfdtd","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/exporting-a-large-number-of-data-sets-into-txt-from-varfdtd\/","title":{"rendered":"Exporting a large number of data sets into TXT from varFDTD"},"content":{"rendered":"<p>Hi,<\/p>\n<p>&nbsp;<\/p>\n<p>I have used a varFDTD frequency monitor to get a plot of the electric field distribution in a disk in 2D (2D Z-normal to be specific). I have ran this simulation over a large number of source wavelength values (I have 501 plots). I want to now export these plots as TXT files. It allows you to do this in the E visualiser individually but I was hoping to not have to do it that way for all 501 plots. I am having trouble automating this through scripting. I can&#8217;t see anything in the documentation for the scripting language. I essentially want to export the TXT information from the monitor for each value of wavelength that I have used. Can anyone advise? For reference, I have pasted my script below:<\/p>\n<p>monitorName = &#8220;E_field&#8221;;<\/p>\n<p>data = getresult(monitorName, &#8220;E&#8221;);<\/p>\n<p>wavelengths = data.lambda * 10^9;<\/p>\n<p># Loop over each wavelength value<\/p>\n<p>for (i=500; i&lt;=size(wavelengths); i=i+1){<\/p>\n<p>&nbsp;<\/p>\n<p>fileName = &#8220;data&#8221; + num2str(i) + &#8220;.txt&#8221;;<\/p>\n<p>#write(fileName, num2str(data.E), &#8220;overwrite&#8221;);<\/p>\n<p>savedata(fileName, data);<\/p>\n<p>}<\/p>\n<p>Thanks in advance!<\/p>\n","protected":false},"template":"","class_list":["post-355434","topic","type-topic","status-closed","hentry"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["43600","2592"],"_bbp_author_ip":["23.206.193.154"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["201"],"_bbp_topic_status":["unanswered"],"_bbp_topic_id":["355434"],"_bbp_forum_id":["27833"],"_bbp_engagement":["2592","43600"],"_bbp_voice_count":["2"],"_bbp_reply_count":["11"],"_bbp_last_reply_id":["356018"],"_bbp_last_active_id":["356018"],"_bbp_last_active_time":["2024-03-08 01:52:30"]},"test":"matthew-wilsonstrath-ac-uk"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/355434","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\/355434\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=355434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}