<?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 Mean in DIAdem</title>
    <link>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3614893#M23398</link>
    <description>&lt;P&gt;Hello Dia 791&lt;/P&gt;
&lt;P&gt;Thank you so much for your answer. However, it seems to me that i did not know exactly how to run it in loop , attached the script that i wrote , what should i modify ?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards.&lt;/P&gt;</description>
    <pubDate>Wed, 19 Apr 2017 08:40:37 GMT</pubDate>
    <dc:creator>say12</dc:creator>
    <dc:date>2017-04-19T08:40:37Z</dc:date>
    <item>
      <title>script Mean</title>
      <link>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3614017#M23382</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;i need to have a script that calculate the mean whether the number of channels that i have, attached the script that i wrote , in the script , my channel is ''courbe'', what could i modifie to have something like this :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;call average (" '[1]/courbe' , '[2]/courbe' ,...,/mean.)until the final channel that i have in the Data portal.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2017 17:32:17 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3614017#M23382</guid>
      <dc:creator>say12</dc:creator>
      <dc:date>2017-04-17T17:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: script Mean</title>
      <link>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3614429#M23391</link>
      <description>&lt;P&gt;Hello say12,&lt;/P&gt;
&lt;P&gt;here the way to do this. Maybe not the best one, but it should work if all your channels are numerical.&lt;/P&gt;
&lt;P&gt;If you have not only one channel group, you need to run it in a loop and activate the new group every time, to get the "Mean" right there...&lt;/P&gt;
&lt;PRE&gt;&lt;FONT face="Courier New" size="1"&gt;dim list, noChn
'
noChn = Data.Root.ChannelGroups(1).Channels.Count
list = "'[1]/[1]' - '[1]/[" &amp;amp; noChn &amp;amp; "]'"
'
Call ChnAverage(list,"/Mean")&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 14:00:21 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3614429#M23391</guid>
      <dc:creator>Dia791</dc:creator>
      <dc:date>2017-04-18T14:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: script Mean</title>
      <link>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3614893#M23398</link>
      <description>&lt;P&gt;Hello Dia 791&lt;/P&gt;
&lt;P&gt;Thank you so much for your answer. However, it seems to me that i did not know exactly how to run it in loop , attached the script that i wrote , what should i modify ?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 08:40:37 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3614893#M23398</guid>
      <dc:creator>say12</dc:creator>
      <dc:date>2017-04-19T08:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: script Mean</title>
      <link>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3614935#M23400</link>
      <description>&lt;P&gt;Well, the change is rather minor:&lt;/P&gt;
&lt;PRE style="width: 1016px; height: 285px;"&gt;&lt;FONT size="1"&gt;&lt;FONT size="2"&gt;dim list, name, noChn, iGroup, noGroup
'
For iGroup = 1 to Data.Root.ChannelGroups.Count                         ' this is a loop over all groups in the NAVIGATOR
  Data.Root.ChannelGroups(iGroup).Activate                              ' set the group as default (activate)
  noChn = Data.Root.ChannelGroups(iGroup).Channels.Count                ' this is the number of the channels in this group
  list = "'[" &amp;amp; iGroup &amp;amp; "]/[1]' - '[" &amp;amp; iGroup &amp;amp; "]/[" &amp;amp; noChn &amp;amp; "]'"  ' create the 'list' for this group
  name = "Mean_" &amp;amp; Data.Root.ChannelGroups(iGroup).Name &amp;amp; "_"           ' here you can adapt the name of the new channel as you like
  Call ChnAverage(list, name)                                           ' create the channel "Mean" inside this group
Next  ' iGroup                                                      &lt;/FONT&gt;    ' go to the next group up to the end
&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;I don't really understand, what&amp;nbsp;do you&amp;nbsp;mean with &lt;EM&gt;"Piece"&lt;/EM&gt; and &lt;EM&gt;"Matiere"&lt;/EM&gt;&amp;nbsp;and where do you want to have this info. If in the name of the new generated channel, so just match the &lt;EM&gt;"name"&lt;/EM&gt; content.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And if you do this for business, I strongly recommend to attend the DIADEM training by NI, it's worth it.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 09:43:30 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3614935#M23400</guid>
      <dc:creator>Dia791</dc:creator>
      <dc:date>2017-04-19T09:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: script Mean</title>
      <link>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3615014#M23404</link>
      <description>&lt;P&gt;Hello Dia 791&lt;/P&gt;
&lt;P&gt;Thank you for your answer , However, when i run the script , it displays the error : '' object doesn't support this property or method : 'Data.root.channelsgroups in the line 19 (as you can see in the picture attached). do you have any idea why?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 12:24:02 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3615014#M23404</guid>
      <dc:creator>say12</dc:creator>
      <dc:date>2017-04-19T12:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: script Mean</title>
      <link>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3615016#M23405</link>
      <description>&lt;P&gt;Hello again&lt;/P&gt;
&lt;P&gt;and to better understand my problem and &amp;nbsp;what i mean , as you can see in the attached &amp;nbsp;script : it allows me to calculate the mean of three test,my problem is that 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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 12:27:04 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3615016#M23405</guid>
      <dc:creator>say12</dc:creator>
      <dc:date>2017-04-19T12:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: script Mean</title>
      <link>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3615022#M23406</link>
      <description>&lt;P&gt;To the failure in line 19:&lt;/P&gt;
&lt;P&gt;there you assign the content to the string variable &lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;moyennes.&lt;/EM&gt; But you use &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Data.Root.Channel&lt;U&gt;&lt;STRONG&gt;s&lt;/STRONG&gt;&lt;/U&gt;Groups(iGroup).&lt;U&gt;&lt;STRONG&gt;moyennes&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;instead of&lt;/P&gt;
&lt;P&gt;Data.Root.ChannelGroups(iGroup).Name&lt;/P&gt;
&lt;P&gt;This property (&lt;EM&gt;moyennes&lt;/EM&gt;)&amp;nbsp;is not known for DIADEM, therefore the error is raised.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Moreover, if you use the variable &lt;FONT face="Arial"&gt;&lt;EM&gt;moyennes&lt;/EM&gt; for the name of the new channel, please use the same variable in the line 20 (not &lt;EM&gt;name, &lt;/EM&gt;which you don't need any more).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Arial"&gt;The discussion goes more in the area of the programming basics... Sorry, but I guess a course would really help.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 12:37:19 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3615022#M23406</guid>
      <dc:creator>Dia791</dc:creator>
      <dc:date>2017-04-19T12:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: script Mean</title>
      <link>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3615031#M23407</link>
      <description>&lt;P&gt;Oh... I didn't understand you at all &lt;img id="smileysurprised" class="emoticon emoticon-smileysurprised" src="https://ni.lithium.com/i/smilies/16x16_smiley-surprised.gif" alt="Smiley Surprised" title="Smiley Surprised" /&gt; The last picture made it better...&lt;/P&gt;
&lt;P&gt;Then the solution provided by Christian should satisfy your needs:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://forums.ni.com/t5/DIAdem/Script/td-p/3614285" target="_blank"&gt;http://forums.ni.com/t5/DIAdem/Script/td-p/3614285&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There it does not matter how many groups you have, since the channel name (e.g. "force") is the same. And you don't need to create the new group every time, one is enough.&lt;/P&gt;
&lt;PRE&gt;Dim ChnList(3)
'
Set ChnList(1) = Data.GetChannels("*/force")
Set ChnList(2) = Data.GetChannels("*/XYZ")
Set ChnList(3) = Data.GetChannels("*/Energy")
'
Call Data.Root.ChannelGroups.Add("Results").Activate
'
Call ChnAverage(ChnList(1), "/Mean_force")
Call ChnAverage(ChnList(2), "/Mean_XYZ")
Call ChnAverage(ChnList(3), "/Mean_Energy")
&lt;/PRE&gt;
&lt;P&gt;For the report, it could be easier to add the curves by drag-and-drop, at least in one report. Then you can see in the curve list, how they are named and what can you change.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 12:53:16 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3615031#M23407</guid>
      <dc:creator>Dia791</dc:creator>
      <dc:date>2017-04-19T12:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: script Mean</title>
      <link>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3615050#M23409</link>
      <description>&lt;P&gt;oh thank you so much , i will try it !!!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 13:12:41 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/DIAdem/script-Mean/m-p/3615050#M23409</guid>
      <dc:creator>say12</dc:creator>
      <dc:date>2017-04-19T13:12:41Z</dc:date>
    </item>
  </channel>
</rss>

