|
Great, in principle it works with textscan, except that
matlab seems to crash at file no 45 and i have plenty
more... any idea how to get around this ? The file is not
corrupted or anything as it is processed if I only then go
from 45 to the next 89 its ok again ?
Any help appreciated
"French Caro " <caro95470@nospam.free.fr> wrote in message
<g2jcce$qve$1@fred.mathworks.com>...
> "julia " <julia.krohn@gmail.com> wrote in message
> <g2jbk1$ht2$1@fred.mathworks.com>...
> > Hi,
> > I am a beginner when it comes to Matlab and am trying
now
> > for some time to get my data in the most efficient way
into
> > matlab for further processing. Its rather a lot of
files
> > (Test1, Test2 ....) which have some headers and are
> > delimited with ; in ASCI format. I was hoping that
there is
> > some automation possible:
> >
> > My input gives me an error with the textread and i dont
> > really know how to fix it. Any help appreciated !
> > -----------
> > clear all; close all;
> > for k = 1:50
> > textfilename = ['Test' num2str(k) '.ASC'];
> > fid = fopen(textfilename, 'rt');
> > data = textread
(fid,'','delimiter',';','headerlines',7);
> > savefile=['Test' num2str(k) '.mat'];
> > nrows=size(data,1);
> > ncolumns=size(data,2);
> > data=data(:,1:ncolumns-1);
> > lengte = length(data);
> > Time=data(1:lengte,1);
> > % then come lots of variable & calc etc which are fine
> > which I omitted here...
> > save(savefile,'Time');
> > fclose(fid);
> > end
> > --------
> >
> >
> >
> Hi,
> I think that you should use texscan in place of textread.
> Both do the same thing but don't have the same inputs :
> textread take as first parameter the name of the file not
> the fid while textscan take the fid (file identifier) as
> first input.
>
> Caroline
|