08-12-2010 10:15 AM
I am new to diadem, and need to programatically create channels for each row of a text file. the rows are of a fixed width.
Thanks
David
08-12-2010 10:46 AM - edited 08-12-2010 10:46 AM
Hey David -
First off, welcome to DIAdem. If you have any followup questions, or additional questions as you continue to work with the environment, feel free to post further.
In regard to programmatic channel creation, try using the following line of script as a starting point:
Call Data.Root.ActiveChannelGroup.Channels.Add("MyNewChannel",DataTypeFloat64)
This will add a new channel with name MyNewChannel and data type Float64 to the active channel group in the Data Portal (the bold channel group). You can add some logic to this to create N channels (one for each channel in your text file).
Is your end goal to load data from a text file into DIAdem for manipulation? If so, the DataPlugin approach may be better for you... Let us know what you're working on and we can follow up with more.
08-12-2010 10:56 AM
Thanks for the prompt reply,
My question really concerned creating the n channels. With regard to naming them, do i just concationate the N indicator on to some string name, and make that the channel name?
Do I need a new block object for each channel?
set Block = File.GetFixedWidthBlock
Thanks
08-12-2010 11:34 AM
Hi David,
Channel naming conventions are up to you. I've seen some channel names that are pulled from information within the file (i.e. "the first column contains channel names"), whereas some are simply added using concatenation logic and an N iterator (i.e. Voltage_1, Voltage_2, Voltage_3, ..., Voltage_N). It is up to your application's needs.
Are you, in fact, writing a DataPlugin? Have you seen the documentation on this or taken a look at our existing Plugins?
08-12-2010 12:20 PM
Yes, and yes. My current data plugin loads three fields of data into three channels. The trouble is that the data is not square (x and y are different) , and I am having trouble graphing it in 3d. That is the reason for creating N channels, so the data can be put in matrix form. (insted of triplets)
I have seen the documentation, and examples, although I have not found vary much regarding exactly what I am trying to do (use n fixedblockwidth channels).
Thanks
David
Please see what I have so far if you are interested.
08-12-2010 04:05 PM
Hey David,
In order for us to make sense of the DataPlugin, we'll need to see an example data file. Any chance you could post it for us to take a look at? You can feel free to simulate the data if you prefer - the format is what is important.
If you're not comfortable posting the example data file, you could visit www.ni.com/dataplugins and click the link that says "Request a DataPlugin be Written For You!" to email the file to us instead.
After we take a look at the structure of the file, we can help with the DataPlugin creation. Thanks!