<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: write data to CSV in LabVIEW</title>
    <link>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253671#M1237882</link>
    <description>&lt;P&gt;Let me suggest an alternative (that example is actually pretty bad).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should not be using the Write To Delimited File inside of a loop.&amp;nbsp; That VI opens the file, sets the file pointer, writes the data, and closes the file each time it is called.&amp;nbsp; Instead, create the file before your loop, write inside as much as you want, and then close the file after the loop.&amp;nbsp; This is SOOOOOOOO much more efficient.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Doing this will also remove the need to deal with arrays like you are.&amp;nbsp; I chose to use the Format String instead of the concatenating as I think it is cleaner.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.ni.com/ni/attachments/ni/170/1237882/1/Example_VI_BD.png" border="0" /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Sep 2022 12:54:12 GMT</pubDate>
    <dc:creator>crossrulz</dc:creator>
    <dc:date>2022-09-06T12:54:12Z</dc:date>
    <item>
      <title>write data to CSV</title>
      <link>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253502#M1237824</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;im using&amp;nbsp;&lt;A href="https://forums.ni.com/t5/Example-Code/Write-Multiple-Columns-With-Write-to-Spreadsheet-File-VI/ta-p/3510276" target="_blank"&gt;Write Multiple Columns With Write to Spreadsheet File VI - NI Community&lt;/A&gt;&amp;nbsp;this example to write the data in csv file but im not getting results as expected. I have 3 output numbers and i want repeat while loop multiple for multiple iterations as im attaching here. but when i run the vi im getting only one value of iteration&amp;nbsp; even im giving 5, 10, 15 or more iterations&amp;nbsp; as input moreover the written values in also is only in one columns not in the different columns. can someone tell me what is the issue in it? and for corrections&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2022 13:28:46 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253502#M1237824</guid>
      <dc:creator>User002</dc:creator>
      <dc:date>2022-09-05T13:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: write data to CSV</title>
      <link>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253506#M1237826</link>
      <description>&lt;P&gt;Hi jeet,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the VI does &lt;STRONG&gt;&lt;U&gt;exactly what you programmed to do&lt;/U&gt;&lt;/STRONG&gt;!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You write the header row each iteration - and even more worse: you create a new file with each iteration…&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to understand those examples before you start to modify them!&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2022 13:38:34 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253506#M1237826</guid>
      <dc:creator>GerdW</dc:creator>
      <dc:date>2022-09-05T13:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: write data to CSV</title>
      <link>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253507#M1237827</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the first use of "Write to spreadsheet file" you are creating the file and adding value.&lt;/P&gt;
&lt;P&gt;Second use you are adding value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you are going to the next loop iteration and do it again, including the creation of the file by overwriting the old one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should create your file outside of this specific loop and only adding values there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="add_to_file.png" style="width: 400px;"&gt;&lt;img src="https://ip1.i.lithium.com/f6935e2cddd503f6c030510d763069107de5f352/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33303736363269364337374233423539414234304441392f696d6167652d73697a652f6d656469756d3f763d76322670783d343030" role="button" title="add_to_file.png" alt="add_to_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2022 13:38:40 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253507#M1237827</guid>
      <dc:creator>Defaphe</dc:creator>
      <dc:date>2022-09-05T13:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: write data to CSV</title>
      <link>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253514#M1237830</link>
      <description>&lt;P&gt;The red Cross means this VI is too old, it was created for LabVIEW 2012, you can replace the with the following VI&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FrankenChino_2-1662385677462.png" style="width: 400px;"&gt;&lt;img src="https://ip1.i.lithium.com/053c41c56003d8c9c67408136266b7a788310e5d/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33303736363669433035353042393536433935313535302f696d6167652d73697a652f6d656469756d3f763d76322670783d343030" role="button" title="FrankenChino_2-1662385677462.png" alt="FrankenChino_2-1662385677462.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FrankenChino_0-1662385611103.png" style="width: 400px;"&gt;&lt;img src="https://ip1.i.lithium.com/5d5b4bd428668d79f03b9de7c7cc500a8fac4e75/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33303736363469413945374345383632414135314532412f696d6167652d73697a652f6d656469756d3f763d76322670783d343030" role="button" title="FrankenChino_0-1662385611103.png" alt="FrankenChino_0-1662385611103.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FrankenChino_1-1662385631936.png" style="width: 400px;"&gt;&lt;img src="https://ip1.i.lithium.com/b8b41d1bfbbf8efb7dbc4e1069eec3b05cfae292/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33303736363569364446414343353939354439394235322f696d6167652d73697a652f6d656469756d3f763d76322670783d343030" role="button" title="FrankenChino_1-1662385631936.png" alt="FrankenChino_1-1662385631936.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;FrankenChino&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2022 13:48:19 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253514#M1237830</guid>
      <dc:creator>Krapfen</dc:creator>
      <dc:date>2022-09-05T13:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: write data to CSV</title>
      <link>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253525#M1237837</link>
      <description>&lt;P&gt;Hi, gerdw&lt;/P&gt;
&lt;P&gt;i made changes as you said.. now im getting data for all the iterations but not in the columns. can you tel me what is the wrong in the vi??? attaching the changes and output ..&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2022 14:23:46 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253525#M1237837</guid>
      <dc:creator>User002</dc:creator>
      <dc:date>2022-09-05T14:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: write data to CSV</title>
      <link>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253532#M1237841</link>
      <description>&lt;P&gt;For a csv file this is OK.&lt;/P&gt;
&lt;P&gt;The interpreter has to know the delimiter and do the work to make it into columns. For a csv it will do it each time it sees a comma.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, depending of the file extension, your Excel will open it as a .xlsx and not doing that work.&lt;/P&gt;
&lt;P&gt;To do it manually in Excel : Excel =&amp;gt; Data =&amp;gt; Convert =&amp;gt; Delimiter = comma.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also choose the delimiter in LABView with a tabulation as delimiter and then no work to do in Excel, but your file is no more a real .csv.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2022 14:37:55 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253532#M1237841</guid>
      <dc:creator>Defaphe</dc:creator>
      <dc:date>2022-09-05T14:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: write data to CSV</title>
      <link>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253536#M1237843</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;change the input as 2D array, change the data input also as 2D array as well, just try out, so you will finger out the mapping of columns and rows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;FrankenChino&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FrankenChino_0-1662388921434.png" style="width: 400px;"&gt;&lt;img src="https://ip1.i.lithium.com/d2a68c4aa5b3816d6b46912b908d3774b9ae819c/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33303736363969413038383542463739423636444636362f696d6167652d73697a652f6d656469756d3f763d76322670783d343030" role="button" title="FrankenChino_0-1662388921434.png" alt="FrankenChino_0-1662388921434.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2022 14:44:17 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253536#M1237843</guid>
      <dc:creator>Krapfen</dc:creator>
      <dc:date>2022-09-05T14:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: write data to CSV</title>
      <link>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253542#M1237846</link>
      <description>&lt;P&gt;this worked thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2022 15:09:54 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253542#M1237846</guid>
      <dc:creator>User002</dc:creator>
      <dc:date>2022-09-05T15:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: write data to CSV</title>
      <link>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253671#M1237882</link>
      <description>&lt;P&gt;Let me suggest an alternative (that example is actually pretty bad).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should not be using the Write To Delimited File inside of a loop.&amp;nbsp; That VI opens the file, sets the file pointer, writes the data, and closes the file each time it is called.&amp;nbsp; Instead, create the file before your loop, write inside as much as you want, and then close the file after the loop.&amp;nbsp; This is SOOOOOOOO much more efficient.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Doing this will also remove the need to deal with arrays like you are.&amp;nbsp; I chose to use the Format String instead of the concatenating as I think it is cleaner.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.ni.com/ni/attachments/ni/170/1237882/1/Example_VI_BD.png" border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 12:54:12 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4253671#M1237882</guid>
      <dc:creator>crossrulz</dc:creator>
      <dc:date>2022-09-06T12:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: write data to CSV</title>
      <link>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4254781#M1238310</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;
&lt;P&gt;im attaching what im trying to do.. im writing data to CSV&amp;nbsp; i as i explained before the and its working now i want to add one function in it. i want to use event structure&amp;nbsp; or any similar function so if i press button save data then only it should save the data or else it should stay idle and it should not save the data in CSV file. can someone tell me how can i do it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2022 11:48:07 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4254781#M1238310</guid>
      <dc:creator>User002</dc:creator>
      <dc:date>2022-09-12T11:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: write data to CSV</title>
      <link>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4254792#M1238318</link>
      <description>&lt;P&gt;Could you post your actual VI?&amp;nbsp; There seems to be a lot of context that would be needed to give a this a proper answer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the image, it looks like you really need a different architecture.&amp;nbsp; I see 2 major red flags:&lt;/P&gt;
&lt;P&gt;1. A "long" task inside of an event case&lt;/P&gt;
&lt;P&gt;2. More than 1 event structure in a VI&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2022 12:36:29 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4254792#M1238318</guid>
      <dc:creator>crossrulz</dc:creator>
      <dc:date>2022-09-12T12:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: write data to CSV</title>
      <link>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4255048#M1238442</link>
      <description>&lt;P&gt;solved it used case instead of event.. thanks&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 13:52:44 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/write-data-to-CSV/m-p/4255048#M1238442</guid>
      <dc:creator>User002</dc:creator>
      <dc:date>2022-09-13T13:52:44Z</dc:date>
    </item>
  </channel>
</rss>

