07-17-2018 05:29 AM
Hi, Sorry, I've attached it as a V14.0 file. Please tell me you'd like an older version if necessary. Actually it has to be false, I must have clicked it accidentally while re-arranging it. But, I've tried the method given by the other users too and still come up with the Error 7 that the filepath is not correct. I tried giving the directory path and also the file path, but to no avail. 😞
07-17-2018 05:52 AM
07-17-2018 06:23 AM - edited 07-17-2018 06:24 AM
@GerdW wrote:
see changed sample VI, with some simplifications.
I simplified it even more. There is not really any point in using the Write Delimited Spreadsheet when you are adding headers. You already have the file open. So just format the data into a string and write that string before you close the file.
07-17-2018 06:51 AM
07-17-2018 06:55 AM
Why do you have a naked event structure sitting there outside the loop?
If you hit the Save button before you hit the Stop button, you are going to lock up your front panel with no way to save your data. You'll be forced to abort your VI. Why? Save:Value Change is set to lock the front panel until the event completes. But you can't hit the stop button which ends the loops so you can get to the event structure because the front panel is locked.
Also, you are using Insert into Array in the loops just to put an element at the front of the array. You should be using Build Array. it is a much simpler function and the correct one to use 99% of the time. Only use Insert into Array when you know you will be (or might be) inserting into the middle of an array.
07-17-2018 09:12 AM
Thank you very much for the suggestion! 😄 It worked like a charm!
07-17-2018 10:07 AM
@RavensFan wrote:
Why do you have a naked event structure sitting there outside the loop?
If you hit the Save button before you hit the Stop button, you are going to lock up your front panel with no way to save your data. You'll be forced to abort your VI. Why? Save:Value Change is set to lock the front panel until the event completes. But you can't hit the stop button which ends the loops so you can get to the event structure because the front panel is locked.
Also, you are using Insert into Array in the loops just to put an element at the front of the array. You should be using Build Array. it is a much simpler function and the correct one to use 99% of the time. Only use Insert into Array when you know you will be (or might be) inserting into the middle of an array.
Hi! I agree with your point, but I could not think of an alternative for the event structure unfortunately. Can you suggest me anything, please?
07-17-2018 10:12 AM
I would just wrap it in a sequence structure frame.
You are already set up so it will only save when the program ends. You want to make sure the save button is read after the program ends and it will either execute the save routine or not. It is basically a shot event, so no need to create an event structure for it.
07-17-2018 10:13 AM
@raghav06 wrote:Hi! I agree with your point, but I could not think of an alternative for the event structure unfortunately. Can you suggest me anything, please?
How about no button and a flat sequence structure (just to make sure the file is not generated until the loop is complete). No button needed. Just log the data regardless. If you later decide you don't want that file, you can delete it.