Borrar filtros
Borrar filtros

Move File to a different folder

2 visualizaciones (últimos 30 días)
TTA
TTA el 7 de Sept. de 2019
Comentada: TTA el 7 de Sept. de 2019
Good day guys,
Please I need a help.
I have a lot file containing temperature profile data. Some of these file contain a lot of irregular data like too high or too low values. But these files I dont know them by their filenames.
I want MATLAB to help me look for the files that contain this irregular values and move these files to a different folder. Please how can i achieve this?
  7 comentarios
Rik
Rik el 7 de Sept. de 2019
The mind reading toolbox isn't released yet, so you will have to provide us with details and/or example files. Otherwise we will not be able to meaningfully help you. We have given you an outline for the solution. Now it's your turn.
TTA
TTA el 7 de Sept. de 2019
Hi Rik,
Attached are the files for example. I want to separate this file that the Temperateure (Temp) falls within 150-350K.
Thanks

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 7 de Sept. de 2019
projectdir = 'files';
dir_for_irregular = fullfile(projectdir, 'irregular');
if ~exist(dir_for_irregular, 'dir')
mkdir(dir_for_irregular);
end
dinfo = dir( fullfile(projectdir, '*_nc')); %eg atmPrf_C004.2010.093.12.28.G28_2013.3520_nc
filenames = fullfile( projectdir, {dinfo.name} );
nfiles = length(filenames);
for K = 1 : nfiles
thisfile = filenames{K};
temperature = ncread(thisfile, 'Temp') + 273.15; %because they are in C
if any(temperature(:) < 150) | any(temperature(:) > 350)
%this file is irregular
movefile(thisfile, dir_for_irregular);
end
end
  1 comentario
TTA
TTA el 7 de Sept. de 2019
OMG............Robertson thanks so much. You just made my day.
I love MATLAB

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Historical Contests en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by