[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Bulk File loading problem
From: |
William Krekeler |
Subject: |
RE: Bulk File loading problem |
Date: |
Tue, 4 Jan 2011 21:32:01 +0000 |
Try a file existence test to skip the non-existant file:
fileName = sprintf ("./Data/TestData_%d_N_2_%d.csv",k,i);
if ( ~exist( fileName, 'file' ) )
continue;
end
dataraw=dlmread( fileName,",",2,0);
Bill Krekeler
-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Søren Hauberg
Sent: Tuesday, January 04, 2011 2:52 PM
To: Louis Ciotti
Cc: address@hidden
Subject: Re: Bulk File loading problem
tir, 04 01 2011 kl. 15:45 -0500, skrev Louis Ciotti:
> Sorry sent the original message before I was done typing.
> any ways I am loading a series of files like this:
>
> for k = 1:MaxFiles
> for i = 1:4
> dataraw=dlmread(sprintf ("./Data/TestData_%d_N_2_%d.csv",k,i),",",2,0)
> .
> .
> .
> .
> endfor
> endfor
>
> It works fine, however occasionally there is a missing file, and the
> .m file stops. Is there a way I can prevent this other than making
> sure that the file is not missing?
Can you put a try-catch block around the dlmread call? I.e. something
like
for k = 1:MaxFiles
for i = 1:4
try
dataraw=dlmread(sprintf ("./Data/TestData_%d_N_2_%
d.csv",k,i),",",2,0);
catch
end_try_catch
.
.
.
.
endfor
endfor
Søren
_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave