IstDerHolger
2007-11-02 16:40:11 UTC
Hi,
I am trying to write a TDM or TDMS File in Matlab. Reading files seems to be straight forward and there is an example on the NI web site. Only when I try to write I am getting an error. I am using the TDM DLL.
Here is the code
dllpath='C:\Program Files\Matlab\R2007a\toolbox\TDMS\dev\bin\nilibddc'
hpath='C:\Program Files\Matlab\R2007a\toolbox\TDMS\dev\include\nilibddc.h'
loadlibrary(dllpath,hpath);
pfile = libpointer('int32Ptr', 0);
result=calllib('nilibddc', 'DDC_CreateFile', 'C:\temp\test.tdm', 'TDM', 'test file', 'test file', 'test title', 'author',pfile)
if result==-6212
result=calllib('nilibddc', 'DDC_OpenFileEx', 'C:\temp\test.tdm', 'TDM', 1, pfile)
end
pgroup=libpointer('int32Ptr', 0);
calllib('nilibddc', 'DDC_AddChannelGroup',pfile.Value,'Model3', 'PLS Model for M345V in Mobile',pgroup)
calllib('nilibddc', 'DDC_SaveFile',pfile.Value);
calllib('nilibddc', 'DDC_CloseFile',pfile.Value);
unloadlibrary('nilibddc');
When I try to add a group I am getting:
DDC_InvalidFileHandle = -6206
Error.
Once I save the files I also can't open them.
Any suggestions?
I am trying to write a TDM or TDMS File in Matlab. Reading files seems to be straight forward and there is an example on the NI web site. Only when I try to write I am getting an error. I am using the TDM DLL.
Here is the code
dllpath='C:\Program Files\Matlab\R2007a\toolbox\TDMS\dev\bin\nilibddc'
hpath='C:\Program Files\Matlab\R2007a\toolbox\TDMS\dev\include\nilibddc.h'
loadlibrary(dllpath,hpath);
pfile = libpointer('int32Ptr', 0);
result=calllib('nilibddc', 'DDC_CreateFile', 'C:\temp\test.tdm', 'TDM', 'test file', 'test file', 'test title', 'author',pfile)
if result==-6212
result=calllib('nilibddc', 'DDC_OpenFileEx', 'C:\temp\test.tdm', 'TDM', 1, pfile)
end
pgroup=libpointer('int32Ptr', 0);
calllib('nilibddc', 'DDC_AddChannelGroup',pfile.Value,'Model3', 'PLS Model for M345V in Mobile',pgroup)
calllib('nilibddc', 'DDC_SaveFile',pfile.Value);
calllib('nilibddc', 'DDC_CloseFile',pfile.Value);
unloadlibrary('nilibddc');
When I try to add a group I am getting:
DDC_InvalidFileHandle = -6206
Error.
Once I save the files I also can't open them.
Any suggestions?