TDMS file update in CVI

Hi Everyone,
I am new in CVI development.. My current work is on TDMS inside CVI 8.5 , I been through CVI help on TDMS and one white paper on NI website..
My current requirement is that user is running application and see the data on graph of user interface.. if user accepts the data and press control buttoon accept the data will get saved in TDMS file.. otherwise user will redo the data acqusition process to see another iteration result to accept or deny..
I am able to write data first time but as i accept another set of data it throws an error
-6604
TDMS_FileCouldNotBeOpened
The file could not be opened.
Inside TDMS_CreateFile function, i understand it may be as file is already created in first iteration..
Is there any way to update the same channel data by appending every iteration with time stamping ?
Thanks for your time and support
Regards
HS
Solved!
Go to Solution.

Hi,
my syntax for control button "Accept" press is as below
int CVICALLBACK DataSave (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
 TDMSChannelHandle mainChannel;
    TDMSChannelGroupHandle mainChanGroup;
    TDMSFileHandle tdmsFileHandle;
 switch (event)
  case EVENT_COMMIT:
    TDMS_CreateFile ("d:\\CVI\\signal.tdms", TDMS_Streaming, "signal", "", "", "",&tdmsFileHandle );
    TDMS_AddChannelGroup (tdmsFileHandle, "Main Group", "Dev1",&mainChanGroup);
    TDMS_AddChannel (mainChanGroup, TDMS_Double, "Main Channel", "ai0", "", &mainChannel);
    TDMS_AppendDataValues (mainChannel, sine, 100, 1);
    TDMS_CloseFile(tdmsFileHandle); 
   break;
  case EVENT_RIGHT_CLICK:
   break;
 return 0;
This works fine as i press Accept first time, this create signal.tdms and save data in mainChannel... But as i press it to save second time it throws error code "-6604" in TDMS_CreateFile syntax...
I want to append the data in mainchannel with time stamp over and over with acceped iteration results.. number of iteration is not predefined sothat ian initialize any array for mainchannel...
Anyway around to get it solved ?
Thanks HS

Similar Messages

  • How do I select more then one channel to view in tdms file viewer graph panel

    I have a TDMS file that I can view with the labview 2013 TDMS file viewer and I can select one signal out of 15 signals to view on the graph panel. however I would like be able to look at 2 or 3 signals
    on the same graph but can't seem to be able to select more then one signal at a time. Is there a way to select more then one to view?  

    I've modified the TDMS viewer in the past to allow selecting multple channels.  It's a little bit of a pain because the tree control in the viewer only allows you to select one item.  You have to edit the tree to allow multiple items.  Now your selection is an array instead of a scalar.  This means the rest of the code has to be updated, and the references to the tree in subVIs need to be updated.  Not impossible but it takes some time.  Alternativly open it in Excel with the free add-in then you can select the two columns you want and insert a graph.  Not as simple for the user but using Excel, which users should be familiar with might mean users need less training on data files.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • How to Read TDMS Files in Matlab in OSX

    Using the example found on the NI website (http://digital.ni.com/public.nsf/allkb/0EEADA99DC​7D00A4862572E30037C3A2), I am able to read my TDMS files into Matlab when using a PC.  However, when I try to read them on my Mac, I receive an error:
    ??? There was an error loading the library "/Applications/MATLAB75/work/TDMS_files/dev/bin/ni​libddc.so"
    Error using ==> loaddefinedlibrary
    dlopen(/Applications/MATLAB75/work/TDMS_files/dev/​bin/nilibddc.so, 1): image not found
    Error in ==> read_tdms at 21
    loadlibrary(DLL_Path, H_Path);
     My best guess for this error is the fact that Matlab operates through a Linux interface on Mac, which I found will open the file type .so and not .dll for this type of library.  Is there some way to get around this in OSX and get it to read the .dll files?  Or is there some way to get the libraries as .so files instead of .dll files?
    Thanks for any help!
    -Shelby

    Shelby,
    You may wish to look at a Matlab script another user wrote since they were having issues with NI's matlab support:
    http://forums.ni.com/ni/board/message?board.id=170​&view=by_date_ascending&message.id=318487#M318487
    The script supposedly converts TDMS files directly in Matlab with no use of NI generated external DLLs.  He was having issues because the NI tools hadn't been updated for the new version of Matlab.

  • How to write Date/Time property of tdms file

    On the root page of the tdms file, there is a built-in property called "Date/Time" in the first row.
    I would like to use it to save the time stamp when the tdms file is created. But in the help file,
    I only find the following property constant. So, how can I write to the "Date/Time" property field?
    Property
    Constant
    Data Type
    Name
    TDMS_FILE_NAME
    String (char *)
    Description
    TDMS_FILE_DESCRIPTION
    String (char *)
    Title
    TDMS_FILE_TITLE
    String (char *)
    Author
    TDMS_FILE_AUTHOR
    String (char *)
    Thanks for any idea or suggestion.
    Solved!
    Go to Solution.

    Not sure if this is exactly what you want, but have you tried this?
    CVIAbsoluteTime CVItime, *t = NULL;
    TDMSFileHandle deH = 0;
    // Create TDMS file and set some properties
    errChk (TDMS_CreateFileEx (file, TDMS_Streaming2_0, TDMS_ByteOrderNative, 0,"example.tdm", "someText", "title", "author", &deH));
    GetCurrentCVIAbsoluteTime (&CVItime);
    errChk (TDMS_SetFileProperty (deH, "Date/Time", TDMS_Timestamp, CVItime));
    // Save and close file
    errChk (TDMS_SaveFile (deH));
    TDMS_CloseFile (deH);
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Not enough memory to complete operation when writing TDMS file.

    Hello,
       I am new to Labview and having a bit of trouble. I attach some code here. What I want to do is sample from a NI 9220 DAQ from 16 channels at 20kHz, while from a second NI 6009 sample from 4 channels at 1000 kHz. I want to append these together and then write to a TDMS file. 
       I have tried to write this code using NIDAQmx VIs but when I have it has resulted in the two DAQs not having the right timing with each other. The 6009 samples for a longer time. 
       I have now tried instead to use the DAQ assistant to read from the two VIs and it works in that TDMS files produced have the correct timing between the two DAQS. However, if I record for more than 2 minutes, in the end I want to end up recording for a much longer time, I have the "Not enough memory to complete operation" message appearing. This still happens even if I get rid of my charts to display the data, and also if I get rid of the NI 6009 completely and just keep the 9220 sampling at 20kHz. It happens even if I repalde my TDMS write and put a write measurement assistant in which I tell it to write a series of files that are each less than 2 minutes long. 
        I think it is something to do with the amount of data I am reading and is being held in memory. What can I do about this? Also, my charts display very slowly, basically evey second when the 20k are read in. However if I lower the amount of data read the charts don't display all the data points. 
        I attach my code, thanks for your help!
        Alfredo 
    Attachments:
    03_02_15.vi ‏688 KB

    alfredog wrote:
    Hello,
       I am new to Labview and having a bit of trouble. I attach some code here. What I want to do is sample from a NI 9220 DAQ from 16 channels at 20kHz, while from a second NI 6009 sample from 4 channels at 1000 kHz. I want to append these together and then write to a TDMS file. 
       I have tried to write this code using NIDAQmx VIs but when I have it has resulted in the two DAQs not having the right timing with each other. The 6009 samples for a longer time. 
       I have now tried instead to use the DAQ assistant to read from the two VIs and it works in that TDMS files produced have the correct timing between the two DAQS. However, if I record for more than 2 minutes, in the end I want to end up recording for a much longer time, I have the "Not enough memory to complete operation" message appearing. This still happens even if I get rid of my charts to display the data, and also if I get rid of the NI 6009 completely and just keep the 9220 sampling at 20kHz. It happens even if I repalde my TDMS write and put a write measurement assistant in which I tell it to write a series of files that are each less than 2 minutes long. 
        I think it is something to do with the amount of data I am reading and is being held in memory. What can I do about this? Also, my charts display very slowly, basically evey second when the 20k are read in. However if I lower the amount of data read the charts don't display all the data points. 
        I attach my code, thanks for your help!
        Alfredo 
    As far as your charts updating very slowly - the way your code is designed, your charts only get data when both 20K samples & 1M samples are done collecting.  Have you tried setting up DAQ assistant for continuous sampling instead of 20K samples or 1M samples?
    -BTC
    New Controls & Indicators made using vector graphics & animations? Click below for Pebbles UI

  • Error -6636 when create a TDMS file

    I use the following function to create a TDMS file. I got the error information. What is the problem? I did add the tdms extension name.
    TDMS_CreateFileEx ("filePath", TDMS_Streaming2_0, TDMS_ByteOrderLittleEndian, 0, "DAQ Test",
    "My TDMS Test execise_1", "Test Result", "", &tdmsFileHandle);

    You must not enclose the pathname in quotes: doing so you are passing an actual file name (without extension) and not the content of the variable with the same name.
    You should not receive that error by calling:
    TDMS_CreateFileEx (filePath, TDMS_Streaming2_0, TDMS_ByteOrderLittleEndian, 0, "DAQ Test",
    "My TDMS Test execise_1", "Test Result", "", &tdmsFileHandle);
    (It's normally a good habit not to have a variable and its content the same).
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Saving FFT PSD waveform to TDMS file maintaining x-axis scale

    Hi all,
    I'm having trouble saving a Power Spectral Density waveform to a TDMS file because the method I'm using is losing the x-axis (frequency) scaling. The only way I can get it to save is extracting the magnitude from the waveform and saving that in the TDMS file. This loses all the frequency information.
    Does anyone know how I can save the PSD information in a TDMS file or failing that, any type of file?
    Thank you,
    Donners
    Solved!
    Go to Solution.
    Attachments:
    PSDs Frequency 2.JPG ‏89 KB
    Data Calculations TDMS 4.zip ‏120 KB
    Filtered Data.zip ‏240 KB

    Hi,
    As my understanding, you are trying to log the PSD to "Power Spectral Density" channel, but you do it wrong with double array. TDMS write don't accept cluster as input, but accept waveform.  I have updated the VI and the PSD in TDMS file viewed as
    Attachments:
    Data Calculations TDMS 4.vi ‏177 KB

  • Cannot open tdms file

    Hi I'm using TDMS format to my project.
    I succedd to log the whole data into TDMS file by using the 
    DAQmxConfigureLogging(taskHandle, logFile.toAscii().constData() ,DAQmx_Val_LogAndRead,"GroupName",DAQmx_Val_OpenOrCreate)
    Now my problem is that when I'm trying to read the TDMS file I can't open it.
    My code of reading is (from the TDMStesing example):
    unsigned int
    length;
    int ddcError = 0;
    DDCFileHandle file = 0;
    char *property = 0;
    // Read file name
    ddcChk (DDC_OpenFileEx (FILE_PATH, "TDMS", 1, &file));
    ddcChk (DDC_GetFileStringPropertyLength (file, DDC_FILE_NAME, &length));
    nullChk (property = (char*)malloc (length + 1));
    ddcChk (DDC_GetFileProperty (file, DDC_FILE_NAME, property, length + 1));
    printf ("File name property: %s\n", property);
    free (property);
    property = 0;
    // Read file description, if present
    if (DDC_GetFileStringPropertyLength (file, DDC_FILE_DESCRIPTION, &length) >= 0)
    nullChk (property = (char*)malloc (length + 1));
    ddcChk (DDC_GetFileProperty (file, DDC_FILE_DESCRIPTION, property, length + 1));
    printf ("File description property: %s\n", property);
    free (property);
    property = 0;
    // Read the channel groups
    ddcChk (ReadGroups (file));
    Error:
    if (property)
    free (property);
    if (file)
    DDC_CloseFile (file);
    return ddcError;
    When I debug the code I got the error code of -6204 at the DDC_OpenFileEx  function
    Error details http://zone.ni.com/reference/en-XX/help/370051K-01/cvi/cvidiademlibraryerrors/
    -6204
    DDC_UnexpectedError
    An unexpected error occurred in the library.
    Need help...
    My setup:
    Hardware: NI 9234
    NI-Daqmx: device driver 9.4.0f5 
    Windows version: XP (sp3)
    Language: Qt (C++)
    Solved!
    Go to Solution.

    Hi all,
    I added the DataModels libs to the project and I succedd to read TDMS file.
    BUT, now I'm trying to read TDMS 2.0 file and I got the next message:
    ERROR: TDS Exception in Initialize: Tds Error: TdsErrFileVersionTooNew(-2510)
    err id : -6210
    Need help
    Atteched the TDMS file
    Attachments:
    tset_tdms.zip ‏781 KB

  • TDMS file viewer not functioning as expected

    I'm new to LV so I'm probably doing something obvious to the battle hardened among you, I'd appreciate a hand!
    I've got a cRio that's running a modified version of one of the datalogging examples, and it's logging to its internal memory, which I FTP into and collect when done. But I'm having some issues with viewing it after. I've created a VI on the host system that looks for the TDMS files on the C drive of the host. I log a file with name "data". I copy over the TDMS and TDMS_Index files to the C drive of the host computer and run the TDMS fileviewer VI on the host, which checks for the file existing and opens it. If the file isn't there it complains, of course (but shows old data in the background). If it is there it opens it. However this is where the problems begin.
    The index headers for the top of the columns of data seem to be changed inside the files but do not always change in the fileviewer output, and the data seems to never be updated with the new data, despite all files having been erased in between runs. I've tried 4 or 5 re-loggings and always get the old data, and often the old indexes. Out of curiosity I changed the log filename to "data2" and changed the viewer path to the new file, copied it across and opened it and it worked flawlessly. Then delete-all and re-recording with the "data2" filename the problem returns - old data held until filename changed.
    The files on the CRio and host are definitely changing each time - their sizes vary when copied across - but the viewer VI doesn't seem to reflect any changes unless the filename is changed on each run, which is a pain. I assumed LV may have some sort of cache of the data, so tried closing LV down each time but it didn't help at all.
    Any ideas? As I say, probably something very obvious but I'm new to LV and haven't spotted it.
    Cheers

    Hey James,
    Your code seems fine; I won’t be able to run it as I don’t have access to
    the Hardware at the moment our RIO is currently under test. However I would
    like to get a screen shot of the TDMS file viewer and also a copy of the TDMS
    file, a brief description of how you want the file edited would be perfect. I
    have done some small re-architecting to your code also. I have just moved the
    data display to the host, as in your "untitled" VI you had a timed
    loop and a normal loop in the same frame. The normal loop in this condition
    will take priority over the timed loop and this could be the reason behind the
    strange data logging experienced in your system. Remember your rules of data
    flow in LabVIEW, so long as all you functions are joining via wires they will
    execute in order and therefore there is no need for sequence structures.
    I have attached the modified code to this post.
    Regards
    Andrew George @ NI UK
    Attachments:
    Host.vi ‏17 KB
    RIO.vi ‏86 KB

  • Script to auto zero channels in a TDM file with multiple channel groups

    Hi friends,
    I am trying to process some data but am having trouble modifying a script to autozero channels across multiple channel groups. The following script works to zero channels across one group. I use this script to process data in a TDM file with only one channel group. I need to be able to zero channels across multiple groups (5 groups). But the amount of groups I will have may change so I might need an option to enter the amount of groups or have the script determine the amount of groups in my TDM file. 
    Here is the code I use to zero the data. Thanks in advance for your help!
    Sub UserDlg_Select
    Call USERDLGINIT()
    USERDLGCAPTION="Auto Zero Channel Based on Specified Points "
    USERDLGTXT(5)="Number of points to Average"
    USERDLGCOMMAND(5)="t1"
    Call USERDLGOPEN()
    End Sub
    Call UserDlg_Select()
    T2="1-"&T1
    For I= 1 To ChnNoMax 'For all data channels except time
    T4=CHNNAME(I) 'Create string for Channel name (I)
    T3=ChnDim(T4) 'Create text variable for channel dimension
    STATSEL(6)="Yes" 'Arith mean
    STATCLIPCOPY="yes"
    STATCLIPVALUE="No"
    Call StatBlockCalc("Channel",T2,T4) 'Calculate Stats for Channel (I)
    'Subtract Mean of first (T1) points for Channel (I)
    Call FormulaCalc("Ch('temp1') := CH('"&T4&"') - statarithmean")
    CHNCOMMENT("temp1")=("Channel zeroed over first "&T1)+"pts" 'Add Comment
    ChnDim("temp1")=T3 'Add Dimension
    CHNNAME("temp1")=T4+"-Z" 'Save updated data with -Z
    'Delete Stat Channels
    Call CHNDEL("ArithmeticMean")
    Call CHNDEL("Sum")
    Next 'End For loop
     

    Hi rvillalta319,
    Sounds like you'll need to adapt your code to use both a for loop and some implementation of the GroupCount variable (or ChannelGroups.Count) as seen here:
    http://zone.ni.com/reference/en-XX/help/370858K-01/varoff/groupcount/
     

  • Error reading TDMS file with inconsiste​nd dt

    Hello all,
    I would like to ask your help to understand how to read a TDMS file which I am opening and closing based on a user input.  As a result the data in the TDMS file does not have a consistent time step, which may be causing my problem, but I really don't know.  I keep getting the error 2501, that I have an invalid reference. 
    Or, if I continue and bypass the error, the extract portion VI gives me an error stating that I need to define an integer multiple of dt.
    I am not sure how to solve the first point as I have the reference wired directly to the read TDMS vi.
    I have attached a screen shot of the error and the portion of the VI with the offending error (it is the code connected to the read TDMS read vi).
    My goad is to extract a portion of the data to do calculations on and display a result to the user.
    thanks for any comments.
    A. Lopez
    Attachments:
    error-2501.JPG ‏198 KB

    I think you open multiple times the same TDMS file, you should open it before the while loop. And I don't see a close tdms function...
    Also check for errors on the open TDMS function.
    Ton
    Message Edited by TonP on 02-14-2007 07:45 AM
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • Adobe Acrobat 8 - file updates not installing on Win 7 Professional

    How do I install MSP file updates to Adobe Acrobat after downloading them? I have just installed Acrobat 8.0 from the original installation CD on a new PC running Windows 7 Professional (64 bit) and have downloaded the update to 8.1.0 to begin with, but on clicking it get the error messsage 'This patch could not be opened. Contact the application vendor to verify that this is a valid Windows Installer patch package'. Updater is not working at all. It says it cannot find any updates. Even when I place the MSP file in the Updater folder to which it is supposed to download updates, it does not find updates. What is wrong? Why won't this patch install? Thank you! I really don't want to be stuck with 8.0.0 when I know that years of updates through to 8.3.1 are available, but for some reason they will not install intuitively.

    Hi ,
    Acrobat 8 is not compatible with Win 7. Please find the mentioned Kb: http://helpx.adobe.com/x-productkb/policy-pricing/system-requirements-acrobat-family-produ cts.html#main_System_requirements_for_Acrobat_8_Pro showing system requirement for installing Acrobat 8. As Acrobat version 8 is very old product so I would recommend you to purchase Acrobat11 which has more enhanced features and functionalities.
    Regards,
    Romit Sinha

  • How can I open a tdms file and replace a subset of data then save that change without re-writing the entire file again?

    Hi all,
    Is it possible to open a tdms file and make a small change an an array subset then save the file without having to save the whole dataset as a different file with a new name? That is to say, is there something similar to "Save" in MS Word rather than "Save As"... I only want to change a 1D array of four data points in a file of 7M data points.
    I am not sure if this make sense? Any help is apreciated.
    Thanks,
    Jack

    You can use either one, but for your application, I would use the synchronous.  It requires far less setup.  When you open the file, set both enable asynchronous and disable buffering to FALSE to enable you to use synchronous with arbitrary data sizes.
    Attached code is LabVIEW 2011.
    This account is no longer active. Contact ShadesOfGray for current posts and information.
    Attachments:
    UpdateTDMS.zip ‏20 KB

  • How to get the last data point from a TDM file in LabVIEW?

    Hello,
    I am using LabVIEW to analyze some rather large TDM files, and I need a way to get only the last data point.  So far, the only way I have been able to accomplish this is by reading the entire file.  Is there a property in the TDM file or a function in LabVIEW that will allow me to get the index of the last item in a channel?  
    Thanks!
    Christina

    Do you want to avoid reading whole file and want to be able to reach or get the index of last value of channel? is there any specific reason? I am not sure you could do it without loading the whole file. But the easiest way would be just to use array functions "array size" would give you the index of last element. 
    -Nilesh
    Kudos are (always) welcome for the good post. :-)

  • Newly written tdm/tdms file not found

    Hi,
    I am trying to save some simple thermocouple data to a tdm/tdms file.  I run my vi and it seems to work just fine. I am using the NI 9213 getting started example as a basis and have added tdms open, tdms set properties, tdms write, and tdms close.  I can see the data streaming on the waveform chart but when I hit stop and go look for the saved file I can't seem to find it.  What am I doing wrong?
    Thank you
    Solved!
    Go to Solution.

    SRamirez wrote:
    I set it to create.  When I run it once for a new folder it runs just fine but if I try again I get error 6.
    You are specifying a folder?  You should be giving a full file path (like c:\temp\blah.tdms).  What you might want to do is build a file name based on the data/time.  This way you won't have to worry about overwriting files and what not.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Build File Name.png ‏9 KB

Maybe you are looking for