LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving a 2D array to a csv file

Solved!
Go to solution

Hello,

I am facing a very strange problem. I have a 2D array of doubles (I put an indicator just to make sure I really have this, and I see a 2D array of 3 columns and 2 rows, which is fine), that I link to a "Write Delimited Spreadsheet (DBL).vi" node, as 2D array entry. The code runs fine, no error is returned, however it saves a 1D array with default values (that are saved in the Write Delimited Spreadsheet (DBL).vi file). It is as if there was no input to that subvi, i.e. as if I had not linked the 2D array.

When I double click on that subvi and I execute the code, I can see that the 2D arrays is passed into the subvi. However it saves the 1D default array instead of the 2D array that just entered. I do not understand why it is the case and how to fix this problem. Any pointer is appreciated.

0 Kudos
Message 1 of 6
(2,253 Views)

Hi bug,

 


@unspotted_bug wrote:

The code runs fine, no error is returned, however it saves a 1D array with default values (that are saved in the Write Delimited Spreadsheet (DBL).vi file). It is as if there was no input to that subvi, i.e. as if I had not linked the 2D array.

When I double click on that subvi and I execute the code, I can see that the 2D arrays is passed into the subvi. However it saves the 1D default array instead of the 2D array that just entered. I do not understand why it is the case and how to fix this problem. Any pointer is appreciated.


Do you mind to attach some (real) code, which demonstrates that erranous behaviour?

With our LabVIEW installations we cannot observe that problem…

 

Btw. also mention other information like LabVIEW version (year, bitness), code target (Windows, RT, which RT exactly)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(2,250 Views)

OK, I have just made a minimal working example displaying this behavior. I attach both this MWE file and the Write Delimited Spreadsheet file.

 

 

LabView 2018 version 18.0.1 (64 bits), Windows 10 OS.

Download All
0 Kudos
Message 3 of 6
(2,229 Views)
Solution
Accepted by topic author unspotted_bug

Hi bug,

 

unfortunately I'm limited to LV2017 right now…

 

(Did you change the WriteDelimitedSpreadsheet function in any way?)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(2,220 Views)

Yes I did, I apparently saved some 1D array in there at some point. I have removed every element, one by one, of that array, and now the code works.

 

So, this makes me think that one should usually never modify the provided vi files of the LabView installation. Unless, of course, one knows what he's doing. I didn't know about that, it should probably be mentionned (if it isn't already) in some noobs mistakes/bad practices.

 

Thanks a lot, problem solved.

0 Kudos
Message 5 of 6
(2,196 Views)

Hi bug,

 


@unspotted_bug wrote:

Yes I did, I apparently saved some 1D array in there at some point. I have removed every element, one by one, of that array, and now the code works.

 

however it saves a 1D array with default values (that are saved in the Write Delimited Spreadsheet (DBL).vi file).


Well, when you debugged your VI you should have seen this behaviour of the WriteDelimitedSpreadsheet VI! That's the way it distinguishes between 1D and 2D data inputs!

 


@unspotted_bug wrote:

one should usually never modify the provided vi files of the LabView installation. Unless, of course, one knows what he's doing.


When you have the need to edit any of the vendor-supplied functions you should NEVER edit them directly.

Always create a copy of that function in your own libraries and edit that copy!

 

(This not only applies to LabVIEW, but to any programming environment…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 6
(2,177 Views)