Ascen Posted November 30, 2007 Report Share Posted November 30, 2007 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: 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! Quote Link to comment
Justin Goeres Posted November 30, 2007 Report Share Posted November 30, 2007 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. Quote Link to comment
Ascen Posted November 30, 2007 Author Report Share Posted November 30, 2007 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. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.