Jump to content

Yet another problem with Read from Spreadsheet File


Ascen

Recommended Posts

Hello..

I'm trying to read MATLAB-saved tab-separated ASCII files into 2-d double arrays,

and while in theory the use of Read From Spreadsheet File seems straightforward,

it for some reason only uses the first significant digit of each number. I've tried

playing around with the formattings (%f instead of default %.3f, %d, %.20f, everything..).

What is the very basic thing I am missing here:

ssheet_fp.jpg

ssheet_bd.jpg

The input data looks like

0.0000000000000000e+000 2.8400000000000000e+002 1.6530000000000000e+003 5.1299999999999997e+001

etc (http://www.hut.fi/~jdahlbom/extinput.txt to get the complete rows.)

What makes this even more annoying is that I've followed the instructions given at this NI site and still

can't get it to work. (The command issued in MATLAB having been 'save extinput.txt datax -ascii -double -tabs')

Thanks for the help in advance!

Link to post

QUOTE(Ascen @ Nov 29 2007, 09:06 AM)

I'm trying to read MATLAB-saved tab-separated ASCII files into 2-d double arrays,

and while in theory the use of Read From Spreadsheet File seems straightforward,

it for some reason only uses the first significant digit of each number. I've tried

playing around with the formattings (%f instead of default %.3f, %d, %.20f, everything..).

What is the very basic thing I am missing here:

LabVIEW is trying to read the data from the input file in a localized format. I.e. it's looking for "XXX,XXXX" instead of "XXX.XXXX".

If you add the text

%.;

to the front of the format string, e.g.

%.;%f

then I think it will work. The %.; tells LabVIEW to look for the . as a decimal separator.

EDIT: Fixed an error. I had the wrong localization specifier before.

Link to post

QUOTE(Justin Goeres @ Nov 29 2007, 06:14 PM)

LabVIEW is trying to read the data from the input file in a localized format. I.e. it's looking for "XXX,XXXX" instead of "XXX.XXXX".

If you add the text

%.;

to the front of the format string, e.g.

%.;%f

then I think it will work. The %.; tells LabVIEW to look for the . as a decimal separator.

EDIT: Fixed an error. I had the wrong localization specifier before.

Heh, thanks a ton for your help, it's working just like it should right now.

Was about to mention that it needed %.; instead of %,; but you beat me to it.

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.