LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read from Text Spreadsheet Issue with scientific exponents

Hello!

 

I am writing a program that takes several text data file inputs and has to turn them into a particular format to be accepted as inputs by another (previously written) exe.

 

The issue that I am having is that exponential numbers were recorded using the scientific notation instead of in decimal form. I want to use the "Replace Array Subset" function, but now I'm not sure how to go about making sure that it grabs the exponents of each value with an exponent and turns it into the decimal value instead of scientific notation. Currently, my program goes through each row and searches for the value E, and I want it to replace that value with the decimal form. The decimal isn't the same very each value, so it's not like I can hardwire a set decimal input to the replace array subset.

 

Is there a way to do this?

 

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

I do not understand your issue here.

 

If the mantissa and exponent are in the same cell then you get both or neither.

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 6
(2,869 Views)

@notAWizard0555 wrote:

Is there a way to do this?

Yes
But it would help if you could attach a copy of your text spreadsheet.

0 Kudos
Message 3 of 6
(2,864 Views)

is this fine to solve your problem?

I'm not sure to understand why you're struggling.string.png

 

0 Kudos
Message 4 of 6
(2,862 Views)

I hate to say this without seeing your data file but...

 

Excel can import just about any file. Launch Excel then go to the "Open" menu and select your file.

 

If your file is not an XLS or XLSX Excel will automatically launch the "file importer" and ask you a few questions about your file structure, (delimiter, fixed width, etc) and then Excel will import the data into a spreadsheet.

 

Now you can select the entire row of data, right click and select "Format Cells" and you can change the number format to anything you want.

 

Oh I just have to ask why the first EXE does not output the data file in the format you need for the second EXE? Makes more sense to fix the first program than to write a third program.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 6
(2,832 Views)

@notAWizard0555 wrote:

Hello!

 

I am writing a program that takes several text data file inputs and has to turn them into a particular format to be accepted as inputs by another (previously written) exe.

 

The issue that I am having is that exponential numbers were recorded using the scientific notation instead of in decimal form. I want to use the "Replace Array Subset" function, but now I'm not sure how to go about making sure that it grabs the exponents of each value with an exponent and turns it into the decimal value instead of scientific notation. Currently, my program goes through each row and searches for the value E, and I want it to replace that value with the decimal form. The decimal isn't the same very each value, so it's not like I can hardwire a set decimal input to the replace array subset.

 

Is there a way to do this?

 


Steps to get help:

  1. Attach one of your data files!
  2. Define "particular format".
  3. Define "exponential numbers", scientific notation", "decimal form" with examples.
  4. Your code image makes no sense unless each array elements is a single letter and I don't think that's right. Why are you even having a 2D array of strings. A text file is a plain scalar string with many characters and delimiters and such.
  5. Are you dealing with integers or possibly fractional values?
  6. How are you reading the file? Show us the code! What are the delimiters?
  7. LabVIEW can deal with exponential format, so the easiest would be to use "read delimited spreadsheet" into a 1D or 2D array of DBLs, then write it out to a new file in a simpler format.
0 Kudos
Message 6 of 6
(2,817 Views)