how to accumulation a cell (x) data. from 30 file data.

2 visualizzazioni (ultimi 30 giorni)
i have 1440x9 cell data from a file, n i have 360 file data in a folder. how to accumulation data cell 3, from 30 file data.
ps:
1 format file is : mm-day-year.dat
2 folder name ex: 2011
3 data accumulation is from 01-01-2011 to 1-30-2011 (a month from 12 month)
4 how to plot result data poin 3 with month. in a year
thanks

Risposta accettata

per isakson
per isakson il 3 Lug 2012
Modificato: per isakson il 3 Lug 2012
This is a start
function cssm( folder_spec, file )
03:05:00 .000 065.501 01** 4864 0086 0074 +19 03:06:00 .000 065.501 01** 4862 0095 0074 +19 03:07:00 R- .026 065.501 01** 4862 0105 0074 +19 03:08:00 R- .180 065.504 01** 4864 0105 0074 +19
sad = dir( fullfile( folder_spec, file ) );
for sa = transpose( sad )
fid = fopen( fullfile( folder_spec, sa.name ), 'r' );
cac = textscan( fid, '%8c%2c%4f%7f%4c%4u%4u%4u+%2u' ...
, 'Delimiter', ' ', 'Whitespace', '' );
fclose( fid );
end
end
Try:
  • set break point at first line
  • run
cssm( 'c:\your_path\2011\', '*.dat' )
  • experiment in break mode with the actual data
  • add working lines of code to the function
  • save and restart function when it becomes messy
  43 Commenti
Soni huu
Soni huu il 4 Lug 2012
can u ceck my m file please(1kb). or can u upload your m file, coz i just have 19 line code and u have 28 line code
per isakson
per isakson il 4 Lug 2012
I downloaded your file and renamed it to "ReadSoniData_2.m" and I changed the name of the function to "ReadSoniData_2". Then I run
>> clear all
>> cac = ReadSoniData_2( 'h:\m\cssm', '11-02-2011.dat' );
>> plot( cac{3})
It worked without problems. The value of the peak is 60 plus.

Accedi per commentare.

Più risposte (1)

per isakson
per isakson il 4 Lug 2012
Modificato: per isakson il 4 Lug 2012
Next step, try:
>> dbstop ReadSoniData 2
>> cac = ReadSoniData( 'h:\m\cssm', '11-02-2011.dat' );
However, if you didn't watch Doug's video you might need to do that now. Then step through the code.
.
The data file, '11-02-2011.dat', shall be in your folder, 'C:\matlab7\work\org'.
You could add an assert to the file after "sad = dir(..."
sad = dir( fullfile( folder_spec, file ) );
assert( not( isempty( sad ) ) ...
, 'ReadSoniData:NoFileFound' ...
, 'Cannot find files matching "%s"' ...
, fullfile( folder_spec, file ) )
  9 Commenti
per isakson
per isakson il 4 Lug 2012
Modificato: per isakson il 4 Lug 2012
Hint: In the for-loop you need to assign the result, which you want to keep to an appropriate variable and make that new variable the output argument.
Case closed!

Accedi per commentare.

Categorie

Scopri di più su Characters and Strings in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by