{"id":2452,"date":"2009-07-31T12:16:33","date_gmt":"2009-07-31T12:16:33","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/2009\/07\/31\/structdlg-part-1-of-2\/"},"modified":"2009-07-31T12:16:33","modified_gmt":"2009-07-31T12:16:33","slug":"structdlg-part-1-of-2","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2009\/07\/31\/structdlg-part-1-of-2\/","title":{"rendered":"STRUCTDLG (Part 1 of 2)"},"content":{"rendered":"<div xmlns:mwsh=\"https:\/\/www.mathworks.com\/namespace\/mcode\/v1\/syntaxhighlight.dtd\" class=\"content\">\r\n   <introduction>\r\n      <p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/5021\">Bob<\/a>'s pick this week is <tt><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/8776-structdlg\">STRUCTDLG<\/a><\/tt> by Marco Cococcioni.\r\n      <\/p>\r\n   <\/introduction>\r\n   <p>This is a nifty data editing tool. Suppose you have a structure with a few named fields in your MATLAB workspace.<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">myStruct.Submission = <span style=\"color: #A020F0\">'Time index'<\/span>;\r\nmyStruct.Author = <span style=\"color: #A020F0\">'Bob'<\/span>;\r\nmyStruct.Address = <span style=\"color: #A020F0\">'http:\/\/wwww.mathworks.com\/matlabcentral\/fileexchange\/21891'<\/span><\/pre><pre style=\"font-style:oblique\">myStruct = \r\n        Author: 'Bob'\r\n    Submission: 'Time index'\r\n       Address: 'http:\/\/wwww.mathworks.com\/matlabcentral\/fileexchange\/21891'\r\n<\/pre><p>Notice the address contains a typo. I could correct it by modifying the code but suppose the data was loaded from a file,\r\n      or typed by an end user (possibly you). What <tt>structdlg<\/tt> provides is a simple tool for editing the values of structure fields.\r\n   <\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">myStruct = structdlg(myStruct);<\/pre><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/..\/..\/images\/pick\/structdlgs1.png\"> <\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">myStruct<\/pre><pre style=\"font-style:oblique\">myStruct = \r\n        Author: 'Bob'\r\n    Submission: 'Time index'\r\n       Address: 'https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/21891'\r\n<\/pre><p>If you build programs in MATLAB for others, this could be an instant and effective plug-in for your applications.<\/p>\r\n   <p>I also want to thank S C for his 07 Nov 2005 <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/8776-structdlg#feedback\">rating comment<\/a>.\r\n   <\/p>\r\n   <p><i>\"This utility is very useful and is very simple and intuitive.<\/i><\/p>\r\n   <p><i>When a more powerful structdlg utility is needed I could be preferable to look to the structdlg version provided by Alon Fishbach\r\n         (you can find it in this forum, also).\"<\/i><\/p>\r\n   <p>Indeed! Next week I will highlight Alon's submission so be sure to check back. Meanwhile, don't be shy about sharing your\r\n      <a href=\"https:\/\/blogs.mathworks.com\/pick\/?p=2452#respond\">comments<\/a>.\r\n   <\/p><script language=\"JavaScript\">\r\n<!--\r\n\r\n    function grabCode_cd18ff4937f3428eb4ace28431871cb6() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='cd18ff4937f3428eb4ace28431871cb6 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' cd18ff4937f3428eb4ace28431871cb6';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        author = 'Robert Bemis';\r\n        copyright = 'Copyright 2009 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add author and copyright lines at the bottom if specified.\r\n        if ((author.length > 0) || (copyright.length > 0)) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (author.length > 0) {\r\n                d.writeln('% _' + author + '_');\r\n            }\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n      \r\n      d.title = title + ' (MATLAB code)';\r\n      d.close();\r\n      }   \r\n      \r\n-->\r\n<\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_cd18ff4937f3428eb4ace28431871cb6()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n            the MATLAB code \r\n            <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; 7.9<br><\/p>\r\n<\/div>\r\n<!--\r\ncd18ff4937f3428eb4ace28431871cb6 ##### SOURCE BEGIN #####\r\n%%\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/5021 Bob>'s \r\n% pick this week is \r\n% |<https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/8776-structdlg STRUCTDLG>|\r\n% by Marco Cococcioni.\r\n%%\r\n% This is a nifty data editing tool. Suppose you have a structure with a few\r\n% named fields in your MATLAB workspace.\r\nmyStruct.Submission = 'Time index';\r\nmyStruct.Author = 'Bob';\r\nmyStruct.Address = 'http:\/\/wwww.mathworks.com\/matlabcentral\/fileexchange\/21891'\r\n%%\r\n% Notice the address contains a typo. I could correct it by modifying the\r\n% code but suppose the data was loaded from a file, or typed by an end user\r\n% (possibly you). What |structdlg| provides is a simple tool for editing the\r\n% values of structure fields.\r\nmyStruct = structdlg(myStruct);\r\n%%\r\n% <<..\/images\/pick\/structdlgs1.png>>\r\n%%\r\nmyStruct\r\n%%\r\n% If you build programs in MATLAB for others, this could be an instant and\r\n% effective plug-in for your applications. \r\n%%\r\n% I also want to thank S C for his 07 Nov 2005\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/8776-structdlg#feedback rating comment>.\r\n%%\r\n% _\"This utility is very useful and is very simple and intuitive._\r\n%\r\n% _When a more powerful structdlg utility is needed I could be preferable to\r\n% look to the structdlg version provided by Alon Fishbach (you can find it in\r\n% this forum, also).\"_\r\n%%\r\n% Indeed! Next week I will highlight Alon's submission so be sure to check\r\n% back. Meanwhile, don't be shy about sharing your \r\n% <https:\/\/blogs.mathworks.com\/pick\/?p=2452#respond comments>.\r\n\r\n##### SOURCE END ##### cd18ff4937f3428eb4ace28431871cb6\r\n-->","protected":false},"excerpt":{"rendered":"<p>\r\n   \r\n      Bob's pick this week is STRUCTDLG by Marco Cococcioni.\r\n      \r\n   \r\n   This is a nifty data editing tool. Suppose you have a structure with a few named fields in your MATLAB... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2009\/07\/31\/structdlg-part-1-of-2\/\">read more >><\/a><\/p>","protected":false},"author":46,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/2452"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/46"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=2452"}],"version-history":[{"count":0,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/2452\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=2452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=2452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=2452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}