Filter löschen
Filter löschen

How to find the mean of the variable sigma0 for 68th julian day,where the 68th julian day consists of 52 sets of data. please provide the codes for this.i'm bit confused.

1 Ansicht (letzte 30 Tage)
dataloc='I: \EOS06\EOS06 LZAT;
savloc='I: \EOS06\EOSO 6 LZANLZA NOTE
cd (dataloc)
allfiles
dir ('*.h51) ;
for abc=273:length(allfiles)
disp([num2 str(abc), "/", num2 str(length(allfiles))])
cd (dataloc)
fname=all
files (abc). name;
  3 Kommentare
Walter Roberson
Walter Roberson am 15 Mai 2023
Is there some aspect of the file name that would allow us to deduce that a particular file has to do with the 68th Julian Day? And the 52 sets of data for the day: is that 52 different files for each julian day, or is it that when you load one file for the particular day, it has 52 sets of data stored inside it?
I do not seem to find any information about any file format that uses an extension of .h51 -- how do you read each file?
dpb
dpb am 15 Mai 2023
Bearbeitet: dpb am 16 Mai 2023
It may not be broken, but it would be far better practice to not cd to the location but to use fully-qualified filenames...
dataloc='I: \EOS06\EOS06 LZAT';
savloc='I: \EOS06\EOSO 6 LZANLZA NOTE';
d=dir(fullfile(dataloc,'*.h51'));
for i=273:numel(d)
fname = fullfile(d(i).folder,d(i).name);
data=??? % as Walter says, how to read these files???
end
As per usual, would be much simpler if attached a sample file so we could tell something about what are looking at; otherwise it's a blind guess.
Also, what are the first 272(*) files returned; you canNOT count on a specific order being returned by dir(), so just counting positions in the listing is not reliable. While dir() on Windows generally appears to have been sorted lexically by name, it isn't guaranteed to be so.
(*) It's abadidea™ to bury "magic numbers" like 273 in the code; if find that simply must use something of the sort, at least create a variable for it so can be changed easily rather than require to modify the code itself. Keep data and code separated.
Also, the above means there have to be at least 273 files that match the dir() wildcard expression for the loop to run at all. Again, it would be far better to have logic to find the file(s) of interest; either by some lookup of what files are associated with what dates or whatever...

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu File Operations finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by