LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading the number from a certain column in an running .CSV file

Solved!
Go to solution

Hi Shannara,

 

you should receive the acquired data as an array of values: use WriteDelimitedSpreadsheetFile to save them!

 


@Shannara wrote:

because I am having problems with data saving?


Which problems do you have? Do you get any error messages?

Why don't you attach your VI with your problematic code?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 31 of 80
(953 Views)

I have tried but I was having problems, can you help me like I want to have a VI, which is attached here that is labview 19.0 version and I need Labview 18.0 version?

can you please save it as labview 18.0 version and send it to me?

0 Kudos
Message 32 of 80
(946 Views)

Hi Shannara,

 

right now I'm limited to LV2017…

 


@Shannara wrote:

I have tried but I was having problems


Again: what have you tried and which problems did you encounter?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 33 of 80
(929 Views)

Hi GerdW,

 

I was using the write delimited spreadsheet fro saving the acquired data which is in the form of a string array. 

The Agilent data logger itself showing e.g. the voltage values as 1.5V. the delimited spreadsheet saved as 1,5. 

The Agilent data logger itself showing e.g. the Resistance values as 1173.45747. the delimited spreadsheet saved as 1173,457,47.

How can control the decimal value because I want 2 decimal points only but it is saving 5 digits after a point?

0 Kudos
Message 34 of 80
(906 Views)

@Shannara wrote:

Hi GerdW,

 

I was using the write delimited spreadsheet fro saving the acquired data which is in the form of a string array. 

The Agilent data logger itself showing e.g. the voltage values as 1.5V. the delimited spreadsheet saved as 1,5. 

The Agilent data logger itself showing e.g. the Resistance values as 1173.45747. the delimited spreadsheet saved as 1173,457,47.

How can control the decimal value because I want 2 decimal points only but it is saving 5 digits after a point?


The "Write Delimited Spreadsheet.vi" has a "format" string input on top. This lets you set the written format. In your case, using "%.2f" should get you 2 decimal places.

(Disclaimer: I don't know much about localization - if your system uses commas instead of periods for decimal separation, you may need to use "%,2f", but I really have no idea)

 

But, here's what I'm saying:

Format string on Write Delimited Spreadsheet_JoB.PNG

If you can get your data as doubles, use the top example.

If it *has* to be a string array, first use "Fract/Exp String To Number" to convert your string array into a Double array, like the second example. 

Or, maybe you can just put the "%.2f" directly on a string array - based on the Help, it looks like it would work, but I'm not sure.

The third example does not work. So don't do that.

 

There are also ways of modifying Strings in a String Array directly - if that's preferable, we can explore that route.

 

Does this help?

-joeorbob

Message 35 of 80
(891 Views)

Thank you so much for the answer.

I have found some problems here, I have to save the acquired data with time stamp, I am using a delimited spreadsheet, timestamp is saving only when the data signal which is in string form so, I have converted my data into string format so, that I can save the data in the correct format.

 

My question is here, I have turned off the localized decimal point to sure it saves the data. when the data is in Numeric array form only %.2f which is working, when the data is in string array it is not working.  

 

may I know How can I solve this problem?

0 Kudos
Message 36 of 80
(875 Views)

Hi Shannara,

 

use the correct format strings - the LabVIEW help describes all their options!

 


@Shannara wrote:

My question is here, I have turned off the localized decimal point to sure it saves the data. when the data is in Numeric array form only %.2f which is working, when the data is in string array it is not working.


To turn off the local decimal point (aka override its settings) you should use the %.; or %,; format code - as described in the LabVIEW help.

 


@joeorbob wrote:

(Disclaimer: I don't know much about localization - if your system uses commas instead of periods for decimal separation, you may need to use "%,2f", but I really have no idea)


Again: its all written in the LabVIEW help… 😄

 


@Shannara wrote:

I have found some problems here, I have to save the acquired data with time stamp, I am using a delimited spreadsheet, timestamp is saving only when the data signal which is in string form so, I have converted my data into string format so, that I can save the data in the correct format.


You need to convert thetimestamp to a string, then you convert all sample data also to string (using a proper format string). Then you can write a full line of data to your CSV file.

 


@Shannara wrote:

The Agilent data logger itself showing e.g. the voltage values as 1.5V. the delimited spreadsheet saved as 1,5.

The Agilent data logger itself showing e.g. the Resistance values as 1173.45747. the delimited spreadsheet saved as 1173,457,47.


There are two possible reasons:

  1. Your LabVIEW VI saves the data using a comma as decimal separator (because of system regional settings).
  2. You are using Excel, again with your specific regional settings, to read the CSV file written usual "English" numeric formats - and Excel fails here because it doesn't care about "English" numeric formats because of your regional settings.

Because of this "Resistance value" example I guess it's an Excel problem. Did you open the delimited text file using a text editor like Notepad to verify your LabVIEW VI really saved this value as "1173,457,47"?

 

In the end it's not a LabVIEW problem, but a "before the keyboard" problem as not using Excel in the correct way…

Spoiler
You can configure Excel to read any kind of CSV file manually in case of not reading it correct automatically!

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 37 of 80
(870 Views)

Is Timestamp can be saved in Array format?

0 Kudos
Message 38 of 80
(861 Views)

This is how I was used to save the acquired data.

May I know is there any mistakes here?data saving.PNG

0 Kudos
Message 39 of 80
(857 Views)

Hi Shannara,

 


@Shannara wrote:

This is how I was used to save the acquired data.

May I know is there any mistakes here?

Mistake: instead of attaching real code (aka VI) you just show an image of part of your code…

Mistake: formatting the numbers using ArrayToSpreadsheetString, then again formatting data using WriteDelimitedSpreadsheetFile…

Mistake: using InsertIntoArray instead of BuildArray when you want to build an array…

 

Simpler:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 40 of 80
(853 Views)