LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2d array to xml

Solved!
Go to solution

I'm sorry to be not accurate enough in my questions, so that you had to write all this things I already know by reading LV help. Of course that doesn't mean I remember or understand everything the right way.

Yes, I'm a bit confused with extensions in alexderjuengere's example, though I understand that it is not vital for file. And I'll explain why: besides file esxtension is assosiated with exact program, it also points the way it should be read by a program. Like .xml file is not the same as .csv, though they both could be read by Excel, but in different ways.

Ofcourse I tried a comma-separated way, using ',' delimiter. But of no use - I'm getting just lines of comma separated values, not in different columns (see picture). And alexderjuengere gave an example with a delimiter that I can't recognise and recreate in my version of LabView. So I think there is some kind of delimiter that is read correctly by Excel and I just can't find which one.

 

Wow! By simple bust found that ';' delimiter works fine! 

Thanks to everyone! Problem solved!

 

0 Kudos
Message 11 of 15
(815 Views)

I'd like to put in my two cents...

If you want to use the Tab- Character as a separator, it ist convenient to name the resulting file with the .txt extension. Excel assumes the Tab- delimiter in text- files and shows the spreadsheet data as expected when the file is dropped onto excel. Doubleclicking the file will possibly not work, since the extension is not assiciated with Excel (like Bob explained).

If you want to use the .csv extension, then it gets a bit complicated when the user doesn't use a native english operating system. There you have to consider the locale specific settings in the "Region and Language" part of the control panel.

 

Region und Sprache (ger).pngWeitere Einstellungen (ger).png

 

When you click the "Additional Settings" - button (on the left picture) you get the dialog "Adapt Format" (or something similar). There you can see, that on my german system the comma ist used as a decimal separator. And the delimiter is a semicolon.

So on my german system (and the systems of my customers) it works very well to create a spreadsheet string with a semicolon as the delimiter and a .csv - extension, this opens Excel displaying the file correctly.

 

Greets, Dave
Message 12 of 15
(803 Views)

Oh, well.  I've just written a DEMO CSV File routine that (a) creates a small array of integers (1-12, as a 3-row, 4-column array), writes a CSV file, reads the CSV file as text (showing an array of 3 lines, the first being "1,2,3,4"), reads it as a delimited spreadsheet to get back a 2D array, and shows that if opened by Excel, is an Excel 3x4 array.  I'm going to post it, anyway, in case others are "challenged" by this issue.

 

You'll note that I also include the "mysterious symbol", a pink right-pointing arrow, that you didn't understand.  If you look on the String Palette, you'll see it is a Tab Constant.

 

Here are the Front Panel, Block Diagram, and Excel image.  The VI is attached in LabVIEW 2015.

CSV File FP.pngCSV File BD.pngCSV Text in Excel.png

Bob Schor

Message 13 of 15
(791 Views)

Wow! Now that is where delimiter simbol is set! Who would ever knew!

So, what do we have here?

.csv is well opened in Excel with proper delimiter symbol, that is set in System preferences.

.txt file is well opened in Excel with default 'tab' delimiter.

Though, as I understand for now, there is no way we can change the format that is used for .xml file. Thus we always have the left side of picture instead of right.

xml.png

0 Kudos
Message 14 of 15
(787 Views)

HaHa!!! Smiley Very Happy Tab constant! Sweeet! Silly of me.

I'm very new in LabView.

0 Kudos
Message 15 of 15
(786 Views)