I copied and pasted some code to save data to a text file. It works fine but I'm not sure why they used shift registers in the example. The example code is in the find examples with LabVIEW, called tab-delimited file.vi. There example was using a for loop. I am using a while loop in my vi. I changed a couple of things. But mainly don't understand the reasoning for using the shift register. In my VI it works with a regular tunnel as well. Can someone help me understand why you would use the shift register and not a regular tunnel.
There are two sets of shift registers in the Tab-Delimited Data example, one for the file refnum, the other for the error cluster. Are you looking to understand both, or a specific one? (My guess from your attached VI is both?)
Quick thought exercise: What happens if ULx Read throws an error partway through execution? Would having tunnels result in different error propagation than shift registers?
(Follow up to that for general code design: If ULx Read throws an error, you may have gotten either no data or incomplete data back. Do you really want to log that to file?)
Well, with just tunnels, if the write file vi throws an error, all I get is the error cluster logging an error right? but no other action. And like you mention, incomplete data could be logged. So with shift registers, the error propagates back into the write file vi and if the previous write is good, we continue. If not, the application stops, right?