08-19-2016 04:14 PM - edited 08-19-2016 04:18 PM
I am trying to export a waveform to a spreadsheet, and I am getting error 1821. I tried to find out what this error means, but had no luck in doing so. Can someone please tell me how to fix this error?
Thanks in advance.
08-19-2016 04:25 PM - edited 08-19-2016 04:26 PM
Hello!
I can see you are building your path in some strange way - try to get familiar with Build Path function:)
https://zone.ni.com/reference/en-XX/help/371361J-01/glang/build_path/
I cannot actually understand what are you trying to do? Write Delimeted Spreadsheet should already write your data to the file, you don't have to write it again in Flat Sequence structure - maybe try to delete the whole flat sequence (or use Diagram Disable Structure to temporary turn it off) and check whether it works for you.
Marcin
08-19-2016 04:30 PM
I removed the flat sequence and I used the build path as you suggested, but now I am getting not a path in the build path.
08-19-2016 04:31 PM
Ahh, OK, now I think I understand that you want to write three different set of data? First in write to spreadsheet file function, second and third in flat sequence structure?
Try to clean up this fragment a little, because what I see is that you are writing to file, then reading again and then again writing...
What actually do you want to have in your CSV file? Waveform contains array of Y values, dt and t0. I think CSV file isn't the good choice here. Have you considered to save only Y values for example?
08-19-2016 04:32 PM - edited 08-19-2016 04:33 PM
I meant remove the whole content of the flat sequence structure 🙂
As to the Not a Path - see the example which is on the website. You have to remove slash: instead of \Resumen.csv it should be Resumen.csv
08-19-2016 04:39 PM - edited 08-19-2016 04:40 PM
I just fixed the build path error, as you suggested, but I can't fix the 1821 error on the export waveform to spreadsheet.
08-19-2016 04:43 PM
Have you deleted all the flat sequence code? Think what is currently happening in your code:
Try to rebuild the whole saving code - starting from small pieces. First try to use only Write to Spreadsheet Delimeted File and then develop functionality - it is the easiest way of debugging.
Marcin
08-19-2016 04:54 PM
how would I close the file, so I can write to it again?
I think the problem occurs after I write the waveform to file and then read from it, and then export the waveform to file. Closing the file after every operation may solve the problem, but I don't know how to do so.
Any help will be greatly appreciated.
Thanks.
08-19-2016 05:00 PM
Why do you want to write the waveform to the file, then read it and then write it again? I cannot see the reason of such an action...
Write to Spreadsheet File function is pretty complicated because of its simplicity 🙂 It is a high level function and you don't have full control of its behaviour. Actually it should close the file immediately but I can say it is not doing so - to be sure, just wait 100 ms after this function and then you can safely assume that the file is closed.
But think about the content of the file!
You have written there some data using Write to Spreadsheet File function, then you write there some other data as a waveform - the file content is completely mixed and then you try to export waveform from the file. But how this function should know where the waveform begins? where it ends? If you want to write waveform to the file just keep it simple one waveform = one file. It will save you a lot of work. Don't mix data in a file unless you are really sure what you are doing!
08-19-2016 05:52 PM