Prev: Why do I get "Has no license available" for my own functions?
Next: Problems with Logs and the gradient function
From: Jagannath Nanduri on 12 Aug 2010 16:46 I am trying to read a file with 80 columns having 5 floats of 16 columns each. Because of the format sometimes there is no delimiter. For example I am trying to read the line -4.789814200D+02 3.243617760D+01 3.128760036D+00 1.178067806D-02-8.318441350D-05 which has no delimiter between floats 4 and 5. textscan(fid,'%f %f %f %f %f',1) is giving me NaN on the last number textscan(fid,'%16f %16f %16f %16f %16f',1) is also giving me a Nan on the last number cannot use %N.df due to the data being in exponential format. I am stumped. Any help is greatly appreciated. Jaggu
From: Walter Roberson on 12 Aug 2010 17:08 Jagannath Nanduri wrote: > I am trying to read a file with 80 columns having 5 floats of 16 columns > each. Because of the format sometimes there is no delimiter. For example > I am trying to read the line > > -4.789814200D+02 3.243617760D+01 3.128760036D+00 > 1.178067806D-02-8.318441350D-05 > > which has no delimiter between floats 4 and 5. > > textscan(fid,'%f %f %f %f %f',1) is giving me NaN on the last number > textscan(fid,'%16f %16f %16f %16f %16f',1) is also giving me a Nan on > the last number > > cannot use %N.df due to the data being in exponential format. > I am stumped. Any help is greatly appreciated. Which version are you using? In 2008b I get, >> S = '-4.789814200D+02 3.243617760D+01 3.128760036D+00 1.178067806D-02-8.318441350D-05'; >> textscan(S,'%16f %16f %16f %16f %16f',1) ans = [-478.98142] [32.4361776] [3.128760036] [0.01178067806] [-8.31844135e-05]
From: Jagannath Nanduri on 12 Aug 2010 17:17
Thanks for the reply. I am running Matlab 7.1. I will upgrade tonight and see if it works. Jaggu Walter Roberson <roberson(a)hushmail.com> wrote in message <i41nta$ms7$1(a)canopus.cc.umanitoba.ca>... > Jagannath Nanduri wrote: > > I am trying to read a file with 80 columns having 5 floats of 16 columns > > each. Because of the format sometimes there is no delimiter. For example > > I am trying to read the line > > > > -4.789814200D+02 3.243617760D+01 3.128760036D+00 > > 1.178067806D-02-8.318441350D-05 > > > > which has no delimiter between floats 4 and 5. > > > > textscan(fid,'%f %f %f %f %f',1) is giving me NaN on the last number > > textscan(fid,'%16f %16f %16f %16f %16f',1) is also giving me a Nan on > > the last number > > > > cannot use %N.df due to the data being in exponential format. > > I am stumped. Any help is greatly appreciated. > > Which version are you using? In 2008b I get, > > >> S = '-4.789814200D+02 3.243617760D+01 3.128760036D+00 > 1.178067806D-02-8.318441350D-05'; > >> textscan(S,'%16f %16f %16f %16f %16f',1) > ans = > [-478.98142] [32.4361776] [3.128760036] [0.01178067806] > [-8.31844135e-05] |