From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read from a 2-d spreadysheet

     Hello all,

I am trying to read datas from a simple 2 column spreadsheet with x value and y value using the "Read From Spreadsheet File.vi". the problem is, the array of datas that are read from the spreadsheet does not contain any decimals; therefore my x-value looks like 954 954 954 954 954 954 954 954 instead of 954.32234 954.55439 954.67843 etc etc. I am using the default format %.3f (which says will keep 3 digit to the right of the decimal place, which obviously is not doing the right thing.) I tried ormat %.6f, doesn't work either.

What should I do?

Thank you!
0 Kudos
Message 1 of 18
(2,906 Views)

Hi northPIG87,

do you read your data as double, string or integer? Can you upload your data file or a part of it?

Mike

0 Kudos
Message 2 of 18
(2,904 Views)
952.520508    1009.000000
952.528870    1006.000000
952.537231    1016.000000
952.545593    1031.000000
952.553955    1130.000000
952.562317    1264.000000
952.570679    1310.000000
952.578979    1306.000000
952.587341    1291.000000
952.595703    1299.000000
952.604065    1332.000000
952.612427    1338.000000
952.620789    1356.000000
952.629150    1353.000000
952.637512    1343.000000
952.645874    1347.000000
952.654175    1328.000000
952.662537    1344.000000
952.670898    1355.000000
952.679260    1352.000000
952.687622    1362.000000
952.695984    1373.000000
952.704346    1356.000000

is a small part of my file. as you can see, all those x values (952.xxx) are read as 952 without the decimal. attached is the block diagram


0 Kudos
Message 3 of 18
(2,897 Views)
Hi northPIG87,
if i copy your data into a txt file, then this code works for me.
 
 
Mike


Message Edited by MikeS81 on 06-05-2008 03:27 PM
0 Kudos
Message 4 of 18
(2,895 Views)


Thanks for your quick help! One stupid question (just started touching labview a week ago ><) ...how did you get that 'Double' thing appear on the code? but i don't see any option to read as double single or what not.

 


0 Kudos
Message 5 of 18
(2,888 Views)

Hi northPIG87,

it´s a polymorphic vi, but it sounds like you use labview 7.x and there is only double available. Smiley Happy

Mike

0 Kudos
Message 6 of 18
(2,885 Views)
Hi Mike...

Hmm interesting, because i am using labview 8. without having that double thing, i added the delimiter of \s\s\s\s you had, and it still doesn't work....
0 Kudos
Message 7 of 18
(2,880 Views)
Hi northPIC87,
can you upload your vi? I´m not sure how it is in LabView 8.0.
Mike
0 Kudos
Message 8 of 18
(2,877 Views)
Hi mike,

Attached is the two Vis needed for my vi. Do not worry about rest of the program, it's just the very beginning when i try to import a set of x and y values for calculation, my x values are rounded off to integers. Just run the vi and it should prompt you to select file to open. Error should occur at Noncurve-linear fitting.vi due to 'singular matrix input' which is caused by the fact that my x value are integers.
p.s. not that it's much related to this, but i am overcoming the rounding off error by adding a third column to my text file which contains the decimal places of my xvalue but timed by 10000. then i divide the third column of data by 10000 in labview through 'read file from spreadsheet.vi' and added it onto my x value to achieve decimal places. stupid way, but works...but it'd be best if i can figure out why i can't just read decimals...

thanks a lot!
Download All
0 Kudos
Message 9 of 18
(2,872 Views)
Hi northPIG87,
it works fine for me. I can´t see your behavior.
Mike
0 Kudos
Message 10 of 18
(2,869 Views)