02-10-2022 03:21 AM
Hello guys, I want to change the description of existing MDF4 files, but I always get -2558 error when I use the Express VI Open Data Storage in open (not read only) mode of operation to open one MDF4 file. However, if I open in open (read only) mode of operation, I will receive -2561 error prompting me that the file is write protected when I use the Express VI Set Multiple Properties.
Attached is the program diagram.
Help me, please!
Solved! Go to Solution.
02-11-2022 06:43 AM
Hi,
So I replicated your code on my side, and was able to figure out the second part of your question. The error -2561 is given because you're opening your file as "read only" which means you are not allowed to update anything about it, not even properties.
Using a probe, I was able to figure out that the problem is coming from the "Open Data Storage" VI. When I tried the create and create or replace options, everything worked completely fine, with no errors. Which means something is happening with the open option in general.
I'll keep trying to understand what the problem is and let you know as soon as I do.
Cheers
02-11-2022 07:06 AM - edited 02-11-2022 07:07 AM
Hi again,
So I did a bit more testing and some reading. This is what I believe the problem is:
The MDF4 DataPlugin doesn't support reading and writing in a pre-existing file. However, it does allow you to open (read only), create, and create or replace a file (also including the file's properties).
I know this because I found others having the same issue in other platforms that also use the same plugin to work with MDF4 files.
A way to solve your situation can be the following:
You can read your file, get whatever data you have/want from it, update the data as or if needed, and replace that file with a new one where you write the new batch of data (that contains the old and new data), and as such you can also update the properties of your file as you wish.
Hope this helps.
02-11-2022 09:10 PM
Thanks a lot!
In fact, I've already done what you said. Here's what I'm confused about:
1. When I change only one attribute value of a few hundred megabytes file, I have to spend a long time waiting for it to complete.
2. The size of the new file is much different from the original file, so I am worried that I cannot perfectly restore its internal structure and other original attributes that I may not be able to copy. In fact, I did have some problems reading files with CANAPE. Some values didn't reflect the meaning of the values as strings (see attached figure).
Looking forward to your reply!
02-11-2022 09:30 PM
Sorry, The abnormal display photo was sent wrong.
02-13-2022 02:53 AM
well, let's take it one by one:
1. Keep in mind, for any type of file (specifically ones that store data), few hundred MBs is actually pretty big. That's mostly why it takes a while for the file to be processed (read or written). I could suggest dividing and storing the data between multiple files and process only one of them based on parameters that you define.
2. Regarding the size of the new file, LabVIEW could be writing the file differently but potentially leading to the same result as the expected one. If you read through the DataPlugin for MDF4 datasheet, it should give you any details about this that you need:
ASAM e.V. DataPlugin for MDF4 21.1 Readme - National Instruments (ni.com)
Good luck and let me know how it works out for you.