09-25-2008 10:22 AM
Is there an example for modifying headers of TDMS files with the TDM C DLL? I can read the data just fine. And, there are examples provided for creating new files/channels. But what about modifying existing groupchannel parameters?
In particular, I am interesting in using MATLAB to set a channel name. From the header file, I understand I should use the DDC_SetChannelPropertyV and that the property should be "name."
<code>
int __stdcall DDC_SetChannelPropertyV (DDCChannelHandle channel,
const char *property,
va_list args);
</code>
I am getting hung up on va_list. I understand this is dependent on the parameter being set, and there are methods to create additional parameters. For exmaple, must I submit a length or data type along with my string? Could someone just explicitly list the args and types for the known parameters:
<code>
// Channel property constants
#define DDC_CHANNEL_NAME "name" // Name
#define DDC_CHANNEL_DESCRIPTION "description" // Description
#define DDC_CHANNEL_UNIT_STRING "unit_string" // Unit String
#define DDC_CHANNEL_MINIMUM "minimum" // Minimum
#define DDC_CHANNEL_MAXIMUM "maximum" // Maximum
</code>
Writing out a "c" function call to the function above would be a bonus. I figure if I know what they are, I can modify the *.h file to get MATLAB to understand the data type expected by the DLL. As it is, all I can get MATLAB to do is crash.
09-26-2008 03:03 PM
Hello allbusiness,
Are you using hardware that you got from National Insrtuments? If so, what is the model number of your hardware?
Best wishes,
Wallace F.
09-26-2008 03:06 PM
USB-6255 BNC
10-08-2008 04:56 PM
Hello allbusiness,
If you are programming in C, you would have to make separate function calls for each DDC channel property that you would want to set. For example, a function call to set the DDC channel name to My DDC Channel might look like this...
int DDC_SetChannelProperty (DDCChannelHandle channel, DDC_Channel_Name, My DDC Channel);
Regards,
Wallace F.
11-30-2010 05:03 AM
Dear all
I am facing a similar problem.
I am creating TDMS files with matlab (similar to the example http://digital.ni.com/public.nsf/allkb/A9094170BAC9A0EC862572E300352CBD) using the 64-bit version of the TDM-C-DLL that can be found here: http://ni.intellisurvey.com/run/2007codelicenseagree
I would like to add a property to my TDMS file. I have tried using
DDC_CreateFilePropertyV and DDC_SetFilePropertyV
<code>
calllib('nilibddc','DDC_CreateFilePropertyV',pfile.Value, libpointer('stringPtr','mypropertyname'),'DDC_Double', num2str(16));
</code>
without success (depending on the data type either matlab crashes or the proporty is set to a wrong value). I'm not sure if I am correctly passing the required "va_list" (last argument) via matlab.
Using "DDC_CreateFileProperty" (without "V") might solve my problem. However, this function is not implemented in the 64-bit version of the TDM-C_DLL.
Does anybody know how to solve this problem?
Thanks!
Bertram
12-01-2010 11:19 AM
Howdy Bertram!
I need to begin this by saying that the TDM DLL is provided as is and without official support so the amount of help I can give is very limited. I only have access to the same documentation you have from downloading the TDM-C-DLL files you linked.
That being said, I did glance over the included help documentation and the header file. I did not see any reference to DDC_CreateFilePropertyV in the help doc, though it did appear in the header file.
Why did you chose to use the "V" version of that function?
Where do you see/how do you know that the "non-V" version of the function is not implemented in the 64-bit version of the DLL?
Have you tried using the DDC_CreateFilePropertyDouble() function instead since you are trying to create a double?
I apologize that I don't have a deeper insight into this library.
Regards,
12-02-2010 03:50 AM - edited 12-02-2010 03:52 AM
Hello Barron
Thanks for your fast reply!
All functions are actually implemented for the 64-bit Version. However, the matlab function 'calllib' does not work with the header file (nilibddc.h) provided with the 2010 version (64-bit and 32-bit). Instead I had used the reduced header file (nilibddc_m.h) that came along with the matlab TDMS example. This works, but not all methods are available.
I now solved the problem by adding the type-safe DDC_CreateFilePropertyDouble() etc. that you suggested to the header file - (adding DDC_CreateFileProperty(..) to the header file will cause matlab to crash). I attached the new header file for other users.
Thanks again - your reply was of great help 🙂
Greetings,
Bertram
12-03-2010 09:30 AM
Awesome! I'm glad to know that worked!
Thanks for posting your modified header file for others to use in future.
Regards,
06-18-2014 03:55 PM
I am trying to write TDM/TDMS files using nilibddc.dll on an old Visual C6 project (that I cant afford to update at this time) under Windows XP.
I am using an older version of the nilibddc.dll (8.6.0.100) and it works if I ignore the error message (-6202) I get from nilibddc.dll/DDC_CreateChannelGroupPropertyTimestampComponents().
I am making all the other calls as shown in the example libary code.
And I am providing the argument types as called for in the header so I am completely puzzled by this behaviour.
Not sure I should ignore the error message but I dont know what to do to fix this.
Anyone else run into this out there?
Cheers,
Don
PS. I tried using the latest library but had a link error I couldnt figure out on VC6.0.
nilibddc.lib(implib.obj) : error LNK2001: unresolved external symbol ___security_cookie
nilibddc.lib(implib.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
Debug/Test TDM.exe : fatal error LNK1120: 2 unresolved externals
06-18-2014 04:24 PM
I figured this out myself ... in case anyone else runs into this.
I didnt realize that there are specific property tags - i found noticed the string "DDC_Timestamp" referred to in the only references I could find and tried it instead of my own property name ...
sprintf(szCHANNEL_NAME,"DDC_Timestamp"); // y160618 Note: when this was "Time Recorded", the
// DDC_CreateChannelGroupPropertyTimestampComponents() func returned -6202
ddcError = DDC_CreateChannelGroupPropertyTimestampComponents (hgroup,
szCHANNEL_NAME,
(unsigned int)year,
(unsigned int)month,
(unsigned int)days,
(unsigned int)hours,
(unsigned int)minutes,
(unsigned int)wholeseconds,
(double)fractionseconds);
Thanks to anyone who notices this posting and I hope my answer helps someone.
Don