Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

why am i getting this error-Characters adjacent to a ** wildcard must be file separators.

1 visualización (últimos 30 días)
>
  1. > %%%%% CODE TO EXTRACT TRMM DATA GRID WISE TO GENERATE TIME SERIES OF RAINFALL DEPTH AT 3 HR INTERVAL
  2. %%%%% BINDHU V M
  3. %TO LOAD ALL THE FILES
  4. dirpath=('D:\trmm2\todel\');
  5. files=dir('D:\trmm2\todel\3B**');
  6. nfiles=length(files);
  7. datadir = 'D:\trmm2\todel\';
  8. fname = '3B42.20071105.12.7A.SUB.nc';
  9. lat1 = ncread([datadir,fname],'latitude');
  10. lon1 = ncread([datadir,fname],'longitude');
  11. %%%% TO EXTRACT THE DATA FOR INDIVIDUAL GRIDS
  12. mydata=[];
  13. for i=1:nfiles
  14. filename=[dirpath files(i).name];
  15. disp(['Processing ',files(i).name]);
  16. rain=ncread(filename,'pcp');
  17. dd=flipud(rain');
  18. c1=reshape(dd',13664,1);
  19. mydata=[mydata c1];
  20. end
  21. data1=mydata';
  22. % data1=data*3;
  23. %%%% TO GENERATE TEXT FILES WITH TIME SERIES OF rainfall intensitiy GRIDWISE
  24. for ii=1:13664
  25. textfilename=['precip' num2str(ii) '.txt'];
  26. fid1=fopen(textfilename,'wt');
  27. fclose(fid1);
  28. end
  29. for iii=1:13664
  30. c=data1(:,iii);
  31. precip=c(:,:);
  32. textfilename=['precip' num2str(iii) '.txt'];
  33. fid1=fopen(textfilename, 'at+');
  34. fprintf(fid1, [repmat('%d\t', 1, size(precip,2)) ''],precip');
  35. fclose(fid1);
  36. end
  37. Error using dir
  38. Characters adjacent to a wildcard must be file separators.

Respuestas (1)

OCDER
OCDER el 20 de Jun. de 2018
The error message seems pretty clear. Characters adjacent to a wildcard must be file separators.
files=dir('D:\trmm2\todel\3B**'); %ERROR. You have a "3B" next to "**".
files=dir('D:\trmm2\todel\3B*'); %OK. This will find all folders (not files) starting with 3B
files=dir('D:\trmm2\todel\3B*.*'); %OK. This will find all files in todel folder matching the 3B*.* format

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by