LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 1821, when exporting waveform to spreadsheet

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.

0 Kudos
Message 1 of 13
(6,713 Views)

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

              

Think Dataflow - blog.mtapp.tech
0 Kudos
Message 2 of 13
(6,706 Views)

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.

0 Kudos
Message 3 of 13
(6,699 Views)

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?

              

Think Dataflow - blog.mtapp.tech
0 Kudos
Message 4 of 13
(6,698 Views)

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

              

Think Dataflow - blog.mtapp.tech
0 Kudos
Message 5 of 13
(6,697 Views)

I just fixed the build path error, as you suggested, but I can't fix the 1821 error on the export waveform to spreadsheet.

0 Kudos
Message 6 of 13
(6,688 Views)

Have you deleted all the flat sequence code? Think what is currently happening in your code:

 

  • You create spreadsheet file and write there some data
  • You don't close the file, you are not sure whether LabVIEW has internally closed the file and you are writing to it immediately
  • Then you are reading the same data from the file and write it again
  • Then you repeat step 2 and step 3.

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

              

Think Dataflow - blog.mtapp.tech
0 Kudos
Message 7 of 13
(6,684 Views)

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.

0 Kudos
Message 8 of 13
(6,675 Views)

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!

              

Think Dataflow - blog.mtapp.tech
0 Kudos
Message 9 of 13
(6,671 Views)
I tried just using the write waveform to file, but that wrote some text to file and not the actual graph.
I want to have the graph generated with LV in the spreadsheet.
Can you please tell me how to accomplish this?
Thanks.
0 Kudos
Message 10 of 13
(6,653 Views)