Home > Back-end >  Matlab question 4: how to calculate, after bulk import TXT textread; Each file output 1, 4 rows of d
Matlab question 4: how to calculate, after bulk import TXT textread; Each file output 1, 4 rows of d

Time:10-27

Matla novice, self-study can fix my part has been written, master correct, genuflect is begged for advice...
Will batch import file, after the import will not calculate
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
CD (' h: \ data) % to be processed the data files in the folder
Filename=dir (' h: \ data \ *. WTH ');
H=length (filename); % the number of files
-- -- -- -- -- -- -- -- -- -- -- -- -- -- --
How to call the data calculated after % 1, import?
For ii=Data (:, :, ii)=textread (filename {2} % f, % f % f, % f, % f 'headerlines, 6));
% % each file has six column header text, remove after data matrix of 365 * or 366 * 5
-- -- -- -- -- -- -- -- -- -- -- -- -- --
% 2, the algorithm of each file, same name how to set the can, in turn, call, or by import above all is ok?
There are three parts to the file name format: ABC, A: 1-3854.
B: 61 on conversion,... 99,01,02,03... After 10 (1961-2010, only take two).
C: all 01. (0001 + 61 + 01)
00016101. WTH
00016201. WTH
00016301. WTH
,
,
,
00019901. WTH
,
,
,
00011001. WTH
00026101. WTH
,
,
,
00021001. WTH
,
,
,

00021001. WTH
,
,
,
38541001. WTH

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
A single file:
[d, s, tmax, tmin, p]=textread (' filemane {jj} ', % f % f, % f, % f % f 'headerlines, 6);
% each file have 6 column header text, remove after data matrix of 365 * or 366 * 5
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
% 3, you will be a single, how to deal with all files?
[d, s, tmax, tmin, p]=textread ('? '% f, % f % f, % f, % f' headerlines', 6);
If the size (d)=(365, 1]
Maxt4=mean (91-120, 3); Mint4=mean (91-120, 4);
% 4 monthMaxt5=mean (121-151, 3); Mint5=mean (121-151, 4);
% 5 monthsMaxt6=mean (151-181, 3); Mint6=mean (151-181, 4);
% 6 monthsMaxt7=mean (182-212, 3); Mint7=mean (182-212, 4);
% 7 monthsMaxt8=mean (213-243, 3); Mint8=mean (213-243, 4); In August the %
Maxt9=mean (244-273, 3); Mint9=mean (244-273, 4);
% 9 months
The else size (d)=(366, 1]
Maxt4=mean (92-121, 3); Mint4=mean (92-121, 4);
Maxt5=mean (122-152, 3); Mint5=mean (122-152, 4);
Maxt6=mean (152-182, 3); Mint6=mean (152-182, 4);
Maxt7=mean (183-213, 3); Mint7=mean (183-213, 4);
Maxt8=mean (214-244, 3); Mint8=mean (214-244, 4);
Maxt9=mean (245-274, 3); Mint9=mean (245-274, 4);
% 4, how to output the first line and the fourth line of text content disp (' 1, 4)?
(maxt4, mint4;
Maxt5 mint5;
Maxt6 mint6;
Maxt7 mint7;
Maxt8 mint8;
Maxt9 mint9);
End

>

CodePudding user response:

File name B: 61-10 cycle several times. Each A, corresponding to A set of B (61-10)
  • Related