Jump to content

bastlwastl

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by bastlwastl

  1. Hey Jim,

    I'm trying to figure out how to append data to an already existing file. I tried the different settings on on the"file open/create/replace" but I have not had any luck. It seems that they way it stores the data overwrites the existing data from before. I have tried to fix this using suggestions posted on the web that implement "set file at position" but this has not worked for me. Currently the way I have my VI set up is that the data is stored in a cluster array that increases in size with every iteration and only after the program stops is all of the data saved. While this works sometimes, I have encountered times where an error has occurred in stopping the program (time out issue, etc) and all of the data was lost. Does your MatIO library have anything to allow for appending or have you not worked that in yet.

    Thanks,

    -Jon

     

    Hi,

     

    first of all, thanks for the great VI's, it was just what i was looking for and its working great so far.

    I also do have a solution for appending to an existing mat file. In my case, I have written a program to configure an oscilloscope and get waveforms from. Therefore, I have some data which are header information, like the actual sampling rate or attenuation etc. and on the other hand the waveform itself. I have one VI collection the header informations and one grabbing the waveform data and both are writing consecutively to the same file. I managed to do this with this matio, if you take care of the following:

    1. Only the first Vi to write to the mat file is generating the initial string with the "WriteHeader.Vi" from matio and passing it to "writeData.Vi".

    2. Every other Vi following just use the WirteData.Vi with the initial string input unwired.

    3. Set the file position always to the end before writing to the binary file.

    Maybe 4. I also ensured a proper logic when reopening the file. I.e. the first time, I use the "create" option with "Open File" and after that the "open only" Option, but I'm not sure weather this has a strong influence. I guess it will "just" give an error, if you try to open an non-existing file et vice versa.

     

    So considering these 3 points, I was able to append to an existing file as described above.

    Have fun and thanks again for these VI's

     

    Bastlwastl

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.