<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Script in DIAdem</title>
    <link>https://ni.lithium.com/t5/DIAdem/Script/m-p/3614984#M23402</link>
    <description>&lt;P&gt;hello christian,&lt;/P&gt;
&lt;P&gt;Thank you so much for your answer, i understand that this syntax allows to call all the elements named 'force' and calculate the mean , i wrote this syntax for the three element that i treat( attached). However, it does not display curves on the report , any ideas ?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
    <pubDate>Wed, 19 Apr 2017 11:46:00 GMT</pubDate>
    <dc:creator>say12</dc:creator>
    <dc:date>2017-04-19T11:46:00Z</dc:date>
    <item>
      <title>Script</title>
      <link>https://ni.lithium.com/t5/DIAdem/Script/m-p/3614285#M23387</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;i'm triyng to write a script that call tha channels which are in the internal data in order &amp;nbsp;to calculate the mean of them. what can i write please ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 09:11:12 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/Script/m-p/3614285#M23387</guid>
      <dc:creator>say12</dc:creator>
      <dc:date>2017-04-18T09:11:12Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://ni.lithium.com/t5/DIAdem/Script/m-p/3614332#M23389</link>
      <description>&lt;P&gt;Hi say,&lt;/P&gt;
&lt;P&gt;Where's the difference to your questions here?&lt;/P&gt;
&lt;P&gt;&lt;A href="http://forums.ni.com/t5/DIAdem/Macro-script/td-p/3610527" target="_blank"&gt;http://forums.ni.com/t5/DIAdem/Macro-script/td-p/3610527&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://forums.ni.com/t5/DIAdem/Mean/td-p/3613342" target="_blank"&gt;http://forums.ni.com/t5/DIAdem/Mean/td-p/3613342&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://forums.ni.com/t5/DIAdem/script-Mean/td-p/3614017" target="_blank"&gt;http://forums.ni.com/t5/DIAdem/script-Mean/td-p/3614017&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;It does not help to open multiple threads for the same question and it will not be faster.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will also find lots of documentation and examples in the internet and installed with DIAdem to do a calculation of mean values.&lt;/P&gt;
&lt;P&gt;Here are some examples:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://zone.ni.com/reference/en-XX/help/370858M-01/dlgmaths/calc_statistics_dlg/dlgstatblockcalc_dialog/" target="_blank"&gt;http://zone.ni.com/reference/en-XX/help/370858M-01/dlgmaths/calc_statistics_dlg/dlgstatblockcalc_dialog/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://zone.ni.com/reference/de-XX/help/370858M-0113/comoff/chnaverage/" target="_blank"&gt;http://zone.ni.com/reference/de-XX/help/370858M-0113/comoff/chnaverage/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://forums.ni.com/t5/DIAdem/How-do-you-do-an-average-of-only-ONE-channel-in-analysis/td-p/1498638" target="_blank"&gt;http://forums.ni.com/t5/DIAdem/How-do-you-do-an-average-of-only-ONE-channel-in-analysis/td-p/1498638&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this does not help, please provide detailed information first, so we can help you to solve the problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 11:16:55 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/Script/m-p/3614332#M23389</guid>
      <dc:creator>Christian-P</dc:creator>
      <dc:date>2017-04-18T11:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://ni.lithium.com/t5/DIAdem/Script/m-p/3614832#M23397</link>
      <description>&lt;P&gt;Hello christian,&lt;/P&gt;
&lt;P&gt;Thank you for your message .To better explain what i mean , attached the script that i wrote to have the mean of three test, i want. i want to have the same script but that allows to have this mean whatever the number of test i have. i thought to run it in a loop but i did not know how to write it !&lt;/P&gt;
&lt;P&gt;Regards&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 06:35:20 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/Script/m-p/3614832#M23397</guid>
      <dc:creator>say12</dc:creator>
      <dc:date>2017-04-19T06:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://ni.lithium.com/t5/DIAdem/Script/m-p/3614923#M23399</link>
      <description>&lt;P&gt;You can do it like this and you will not need a loop at all:&lt;/P&gt;
&lt;PRE&gt;dim ForceChnList
set ForceChnList = Data.GetChannels("*/force")
call Data.Root.ChannelGroups.Add("Results").Activate()
call ChnAverage(ForceChnList, "/Mean")&lt;/PRE&gt;
&lt;P&gt;The GetChannels command searches for all channels with name "force" in all groups and will return an ElementList that can be used with ChnAverage command.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://zone.ni.com/reference/en-XX/help/370858M-01/inavidata/objects/diacmpnt_objects_idiademelementlist/" target="_blank"&gt;http://zone.ni.com/reference/en-XX/help/370858M-01/inavidata/objects/diacmpnt_objects_idiademelementlist/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 09:24:45 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/Script/m-p/3614923#M23399</guid>
      <dc:creator>Christian-P</dc:creator>
      <dc:date>2017-04-19T09:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://ni.lithium.com/t5/DIAdem/Script/m-p/3614984#M23402</link>
      <description>&lt;P&gt;hello christian,&lt;/P&gt;
&lt;P&gt;Thank you so much for your answer, i understand that this syntax allows to call all the elements named 'force' and calculate the mean , i wrote this syntax for the three element that i treat( attached). However, it does not display curves on the report , any ideas ?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 11:46:00 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/Script/m-p/3614984#M23402</guid>
      <dc:creator>say12</dc:creator>
      <dc:date>2017-04-19T11:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://ni.lithium.com/t5/DIAdem/Script/m-p/3614995#M23403</link>
      <description>&lt;P&gt;Your script creates a new group for every result channel.&lt;/P&gt;
&lt;P&gt;If you try to create a group that already exists, DIAdem will create a new group with an index at the end.&lt;/P&gt;
&lt;P&gt;Only create and activate the group once at the beginning.&lt;/P&gt;
&lt;P&gt;I don't know if this solves your report problem as well.&lt;/P&gt;
&lt;P&gt;You have to provide more information to describe your problem.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 11:54:52 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/Script/m-p/3614995#M23403</guid>
      <dc:creator>Christian-P</dc:creator>
      <dc:date>2017-04-19T11:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://ni.lithium.com/t5/DIAdem/Script/m-p/3615046#M23408</link>
      <description>&lt;P&gt;hello christian&lt;/P&gt;
&lt;P&gt;Thank you for your help , well, i'm doing currently some test, which give me data(energy, force...) that i pos treats by diadem, i must for each number of test calculate the mean, i wrote a script for three and five test ( as you can see in the pictures attachd) , and now i have to write a script that allow me to calculate this mean whatever the number of test i do. i'm really desperate , any help please ? &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 13:11:22 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/Script/m-p/3615046#M23408</guid>
      <dc:creator>say12</dc:creator>
      <dc:date>2017-04-19T13:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://ni.lithium.com/t5/DIAdem/Script/m-p/3615061#M23410</link>
      <description>&lt;P&gt;Hi say,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Christian gave you the important tip to use the Channel List approach-- this enables you to have the same code respond to any number of input channels, so long as their channel names are the same. &amp;nbsp;You just need to loop that code over your 3 channel names, like this:&lt;/P&gt;
&lt;PRE&gt;dim ChanList, ChnNames, ChnName, ResultGroup, ResultChannel
ChnNames = Array("force", "force_xyz", "Energy")
set ResultGroup = Data.Root.ChannelGroups.Add("Results")
Call ResultGroup.Activate()
FOR Each ChnName In ChnNames
  set ResultChannel = ResultGroup.Channels.Add("Mean_" &amp;amp; ChnName, DataTypeChnFloat64)
  set ChanList = Data.GetChannels(ChnName)
  call ChnAverage(ChanList, ResultChannel)
NEXT ' ChnName&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Brad Turpin&lt;/P&gt;
&lt;P&gt;DIAdem Product Support Engineer&lt;/P&gt;
&lt;P&gt;National Instruments&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 13:25:29 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/Script/m-p/3615061#M23410</guid>
      <dc:creator>Brad_Turpin</dc:creator>
      <dc:date>2017-04-19T13:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://ni.lithium.com/t5/DIAdem/Script/m-p/3615063#M23411</link>
      <description>&lt;P&gt;thank you so much for your help , i'm going to think about all thoses solutions!&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 13:28:46 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/Script/m-p/3615063#M23411</guid>
      <dc:creator>say12</dc:creator>
      <dc:date>2017-04-19T13:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://ni.lithium.com/t5/DIAdem/Script/m-p/3615082#M23413</link>
      <description>&lt;P&gt;Oops, i have an error in the line 23 , Error : No channel or only one channel selected==&amp;gt; cannot calculate mean , any ideas ? :'( :'( :'(&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 13:48:08 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/Script/m-p/3615082#M23413</guid>
      <dc:creator>say12</dc:creator>
      <dc:date>2017-04-19T13:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://ni.lithium.com/t5/DIAdem/Script/m-p/3615370#M23422</link>
      <description>&lt;P&gt;Hi say,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I get the same error you report when the ChanName string can not be found at least 2 times in the Data Portal. &amp;nbsp;Here's a version that checks for that and logs the issues in the log file (below the script in the SCRIPT editor).&lt;/P&gt;
&lt;PRE&gt;dim ChanList, ChanNames, ChanName, ResultGroup, ResultChannel&lt;BR /&gt;ChanNames = Array("force", "force_xyz", "Energy")&lt;BR /&gt;set ResultGroup = Data.Root.ChannelGroups.Add("Results")&lt;BR /&gt;Call ResultGroup.Activate()&lt;BR /&gt;FOR Each ChanName In ChanNames&lt;BR /&gt;  set ChanList = Data.GetChannels(ChanName)&lt;BR /&gt;  IF ChanList.Count &amp;gt; 1 THEN&lt;BR /&gt;    set ResultChannel = ResultGroup.Channels.Add("Mean_" &amp;amp; ChanName, DataTypeChnFloat64)&lt;BR /&gt;    call ChnAverage(ChanList, ResultChannel)&lt;BR /&gt;  ELSE&lt;BR /&gt;    LogFileWrite "Couldn't find enough channels of type: " &amp;amp; ChanName&lt;BR /&gt;  END IF&lt;BR /&gt;NEXT ' ChnName&lt;/PRE&gt;
&lt;P&gt;Brad Turpin&lt;/P&gt;
&lt;P&gt;DIAdem Product Support Engineer&lt;/P&gt;
&lt;P&gt;National Instruments&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 20:49:53 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/Script/m-p/3615370#M23422</guid>
      <dc:creator>Brad_Turpin</dc:creator>
      <dc:date>2017-04-19T20:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://ni.lithium.com/t5/DIAdem/Script/m-p/3615535#M23423</link>
      <description>&lt;P&gt;Hello Brad,&lt;/P&gt;
&lt;P&gt;Thank you for your answer , the script is now running , but i think that it doesn't calculate the mean, i only have one case named "result : as you can see in the figure attached : 'result')&lt;/P&gt;
&lt;P&gt;However, i tried another script ( attached in the other figure named : another script') provided by Dia 791, what do you think about it? i think that it works&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 07:33:07 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/Script/m-p/3615535#M23423</guid>
      <dc:creator>say12</dc:creator>
      <dc:date>2017-04-20T07:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://ni.lithium.com/t5/DIAdem/Script/m-p/3617574#M23440</link>
      <description>&lt;P&gt;Hi say,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your original request was for "&lt;SPAN&gt;the mean of three test[s]&lt;/SPAN&gt;". &amp;nbsp;I understood you to want to calculate the mean of N channels that all shared the same channel name but were stored in N different groups. &amp;nbsp;That's what the script I sent you does-- you get one result channel for each original channel name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this is not what you're after, please try again to explain what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Brad Turpin&lt;/P&gt;
&lt;P&gt;DIAdem Product Support Engineer&lt;/P&gt;
&lt;P&gt;National Instruments&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 19:38:20 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/Script/m-p/3617574#M23440</guid>
      <dc:creator>Brad_Turpin</dc:creator>
      <dc:date>2017-04-24T19:38:20Z</dc:date>
    </item>
  </channel>
</rss>

