Prev: Replication of axes on the other side of the plot - when is it there, when is it not there?
Next: Neural Networks weights and bias help
From: Lennart van Luijk on 13 Aug 2010 10:42 Hi, I'm having the same problem as the thread starter. I've checked with R2008a and R2010a, both with different types of datafiles. All have the same behaviour, meaning both matlab versions and both datafiles. When running importdata, specifying 5 headerlines means that the function now only reads the first 5 lines of the datafile. These lines are represented in both matlab versions by a 5x1 cell array in which each cell array consists of a 1x99 char (99 being an example length). The older datafile is very simple and was always correctly imported. I've added a directory to my R2010a path, but the problem occurs also if I remove this again AND in the R2008a installation without this added path. Also, none of my own functions are named 'importdata'. In a nutshell, it seems like very strange behaviour! Especially because the to-be-skipped number of headerlines are now the only lines that are read by the function. "Vadim Teverovsky" <vteverov(a)mathworks.com> wrote in message <hrv3u8$m12$1(a)fred.mathworks.com>... > In addition to Steve's suggestions, a next step would be to step through the > importdata function in the debugger, to see where its doing something > unexpected. It seems likeliest that the format of the file changed, perhaps > in a subtle way. > > Also, what is the string that is returned to you? Is it all of the data in > the file, or just one line? > > > "Steven Lord" <slord(a)mathworks.com> wrote in message > news:hrv341$r9s$1(a)fred.mathworks.com... > > > > "Lew " <lgramer-remove-this(a)rsmas-point-miami-point.edu> wrote in message > > news:hruq05$jho$1(a)fred.mathworks.com... > >>I have just noticed that the behavior of IMPORTDATA on my (I thought) > >>stable old install of MATLAB R2007a on Windows XP has changed: but it is > >>more extreme than what you describe, and it has occurred only just as of > >>the past 30 days or so! In my case, > >> > >> >> x = importdata('fwyf1h1991.txt'); > >> > >> with a text file formated similar to this (space separates columns - no > >> tabs; and note, header wraps on this form, but occupies only one line in > >> file): > >> > >> YY MM DD hh WD WSPD GST WVHT DPD APD MWD BAR ATMP WTMP DEWP > >> VIS > >> 91 06 15 00 083 05.3 05.6 99.00 99.00 99.00 999 1017.2 27.8 999.0 999.0 > >> 99.0 > >> 91 06 15 01 088 04.9 05.4 99.00 99.00 99.00 999 1018.1 27.8 999.0 999.0 > >> 99.0 > >> 91 06 15 02 085 07.2 07.6 99.00 99.00 99.00 999 1018.0 27.7 999.0 999.0 > >> 99.0 > >> ... [many lines deleted] > >> > >> This call formerly (in R6.5 right up to last month) returned a struct x > >> with two fields, x.data a double matrix containing all numerical data > >> from the file, and x.textdata a cell array of strings containing > >> everything else. This ran fine just four weeks go, but today on my > >> (essentially unmodified) 2007a install, IMPORTDATA is instead returning > >> "x" as a single 1xN character array(!) This breaks all kinds of code. > >> What has caused this, and what is the work-around for making IMPORTDATA > >> useful again?? (I could of course rewrite all my code that uses > >> IMPORTDATA to instead make detailed calls to TEXTSCAN. But I am *really* > >> hoping to avoid that.) > > > > Unless you've written your own function that shadows a function used by > > IMPORTDATA, or in some other way modified your MATLAB installation, I > > wouldn't expect the behavior of IMPORTDATA on the same file to have > > changed. Let's check a few simpler things first. > > > > 1) Has the data file changed between the last time it imported as a struct > > array and the first time it imported as a single char array? If so, can > > you test IMPORTDATA on a copy of that file from prior to that last change? > > [This will eliminate the case where the file changed so that its format > > was no longer consistent enough to be returned as a struct. Something as > > small as a missing space could have done this, theoretically.] > > > > 2) Have any of the files included in your MATLAB installation changed > > between the last successful import and the first unsuccessful? In > > particular, has importdata.m changed? A rudimentary check for this is to > > look at the timestamp of the file in Windows Explorer. > > > > 3) Have any directories been added to or removed from your MATLAB path? > > In particular, did you install any new toolboxes (whether from The > > MathWorks or from another party) or did you uninstall any toolboxes? > > > > 4) If you still have access to your installation of MATLAB 6.5, does the > > file still import as a struct in that version? If not, that would suggest > > to me that either the same change happened in both installations or that > > the problem was not caused by either installation but something > > lower-level. > > > > -- > > Steve Lord > > slord(a)mathworks.com > > comp.soft-sys.matlab (CSSM) FAQ: > > http://matlabwiki.mathworks.com/MATLAB_FAQ > > > > > |