08-24-2009 03:56 AM
Hello,
I've not gone near DIAdem for a while, and now am sat here confused over something which is probably pretty simple.
In part of my script, I want it to go through all my channels, and greate a separate group with the name of the original channel... then I will go through and do some more advanced analysis in each group. The part which is causing problems is creating the groups in the first place.
I have something like this:
dim x
for x=2 to GroupChnCount(1)
Call GroupDefaultSet(1)
nameofgroup=ChnNameGet(x)
Call GroupCreate(nameofgroup,x)
next
Yet all I get is "Variable is undefined: 'ChnNameGet'
What am I doing wrong??????
Thanks!
Solved! Go to Solution.
08-24-2009 10:42 AM
Hi xxxtomxxx,
Mainly you just had the order of the commands incorrect:
Dim x
FOR x = 2 to GroupChnCount(1)Call GroupCreate(ChnName(x))
Call GroupDefaultSet(GroupCount)
' Run analysis that creates channels in this new Group
NEXT ' x
Brad Turpin
Ddem Product Support Engineer
National Instruments
08-24-2009 10:47 AM
Hello Tom!
The error message is correct! There is no ChnNameGet command in DIAdem. You can use ChnName( CNoXGet(1, x)) to get what you want.
Matthias
Matthias Alleweldt Project Engineer / Projektingenieur | Twigeater? |
08-24-2009 10:58 AM
Hello Brad!
Does ChnName(x) works in all circumstances? I was told to use CNoXGet(...).
Matthias
Matthias Alleweldt Project Engineer / Projektingenieur | Twigeater? |
08-25-2009 10:18 AM
Hi Matthias,
I'm flattered that you asked me a question 🙂
I used CNoXGet() very frequently in DIAdem versions prior to 11.0, but less so now that we have the Data.Root object. With ChnName() and most "normal" DIAdem functions that take Channel references (string) as parameters, you can provide either a variant of subtype integer filled with the global Channel number or a variant of subtype string filled with the Channel reference. The Channel reference usually contains the full Group/Channel path ("[1]/Revs"), but DIAdem will still also accept the older Channel only ("Revs") referencing. When using either the global channel number (integer) or the Channel only (string) approach, you run the risk of not referencing the channel you really meant. So if given the choice between that and using CNoXGet(GroupIndex, ChannelIndex), the CNoXGet() function is much more reliable and also particularly convenient for looping through all the channels of a particular Group.
Now in DIAdem 11.1, though, all the main DIAdem functions accept a Channel object variable in the parameter that used to accept the channel reference, so creating and using Group and Channel object variables has become the norm for me, like this:
Set Channel = Data.Root.ChannelGroups(1).Channels("Revs")
Call ChnSmooth(Channel, Channel, 50, "symmetric")
Brad Turpin
DIAdem Product Support Engineer
National Instruments
04-01-2019 06:41 AM
Hey Brad,
I have a Problem aswell, i have attached the data below which includes the data to be evaluated and the vbscript. In the script how do I Count the number of sensors without manually giving in the number of sensors. The T and P infront of the sensors are the temperature and pressure readings. and what do i do if for example one channel in missing
04-01-2019 05:09 PM
Hi Ali,
Would you try to post your data file again? All I see is your VBScript.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
04-03-2019 03:02 AM
Hey Brad,
Sorry for that. I have uploaded the file, in this case I have to enter the number of 'sensors' manually, is there any way to automate this?
and in this case there are 5 files, each containing the pressure,temperature readings. The 5 files represent the temperature and pressure readings of the same sensors at different times, in some cases the sensor stops working and hence does not have a reading and therefore no corresponding channel for temperature and pressure, in this case if a channel for a sensor is missing in that particular file, how do I skip to the next Iteration so that it continues on for the other sensors and there corresponding pressure and temperature readings.
*The 'Gesamtdaten' at the end is 'adding' all the sensors so that I one Total data.
Thanks
04-16-2019 04:31 PM
Hi Ali,
You sent me a zipped up TDX file. Assuming this is the data part of the TDM/TDX file pair, I'm still missing the TDM header file, and there's no way I can load the binary values in the TDX file until I have the matching TDM file.
Sorry I didn't look at this sooner,
Brad Turpin
DIAdem Product Support Engineer
National Instruments
04-17-2019 03:43 AM