03-30-2020 10:32 AM
I'm extremely new to Labview, so I'm not entirely sure what you just said. 😁 How would I change the format? Replace the binary format cluster?
03-30-2020 10:45 AM
Yes. Add what ever you need to the cluster and that becomes your new format.
03-30-2020 10:47 AM
@aeastet wrote:
Yes. Add what ever you need to the cluster and that becomes your new format.
Do note that this will mean that your new code will NOT be able to open files using the older format. Another reason to change to an ini, xml, or json file format.
03-30-2020 11:06 AM
Is it as simple as inserting a 'Create Text File' vi in between the binary file output and close file input? Or is there a special vi special to file conversion?
03-30-2020 11:32 AM
@JayWW wrote:
Is it as simple as inserting a 'Create Text File' vi in between the binary file output and close file input? Or is there a special vi special to file conversion?
My recommendation is to completely gut out how the file is currently saved/read and make VIs to do the same job using a more user friendly and expandable format. I am talking a complete replacement to make your future life easier.
03-30-2020 11:56 AM - edited 03-30-2020 11:57 AM
@crossrulz wrote:
My recommendation is to completely gut out how the file is currently saved/read and make VIs to do the same job using a more user friendly and expandable format. I am talking a complete replacement to make your future life easier.
I agree with this. However, it is unclear to me if you're adding hardware or replacing old hardware and just need to change some values in the existing configuration. If just need to change then a quick solution might be read, change values, then write, not having to change any existing code.
03-30-2020 12:10 PM
I'm replacing a couple of power supplies that have different values than the old power supplies. Just making a quick change to some values would be ideal.
03-30-2020 12:36 PM
@JayWW wrote:
I'm replacing a couple of power supplies that have different values than the old power supplies. Just making a quick change to some values would be ideal.
Read the values just like in the picture that you posted, change the necessary values in the cluster, and then write the cluster back to file using Write to Binary File. I would make sure that I had a backup of the existing file before doing anything (just in case you're not using some type of source code control, or this file is not included in the source code control).
03-30-2020 12:41 PM
I found this vi in an older thread, but it didn't work. It basically output the file the same way Notepad would.
03-30-2020 12:48 PM
So what you have there is a "binary" file. This means the file type was custom-defined by the guy you inherited your code from. You can't open it (meaningfully) with anything, at all, other than a LabVIEW program configured exactly the same as he defined it.
Your code there tells you how to decode it. The Cluster going into "Read binary file" is the "type" of that file. That cluster being there tells LabVIEW how to interpret it.
What you need to do is to Read the file into LabVIEW, change it within LabVIEW, then do a Write to Binary File. The wire coming out of "Read" is the actual data within the file. You can modify that data within LabVIEW then write it using a "Write binary file" function.
There is no way to make this file human-readable, as your main code expects the file in that specific format. Thus, you can either change ALL of the code that reads the file to something simple (like ini/xml/json) or if you just need to change a value, make a new program that does Read-Modify-Write, all within LabVIEW.