I have the following code which runs but doesn't do what I want it to do. Here am reading data from a file and I want to group it according to its DUR,e.g. the event that have a DUR=1 be in the subfolder 01 under events, and so forth.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
fn=sprintf('ridging_daily_evolution_1980.txt');
A=load(fn);
[m,n]=size(A);
for i=1:m-1
DUR=A(i,5);
lat=A(i,3);
lon=A(i,2);
if DUR ~=1
DATE=A(i-(DUR-1),1);
else
DATE=A(i,1);
end
STR_DUR=num2str(DUR);
STR_DATE = num2str(DATE);
B = [STR_DATE lon lat STR_DUR];
if DUR < 10 && DUR >0
DUR_NAME = sprintf('0%s',STR_DUR);
else
DUR_NAME = sprintf(STR_DUR);
end
end
gn=sprintf('events/%s/%s',DUR_NAME,STR_DATE);
fid = fopen(gn,'wt');
fprintf(fid,'%10.2f %10.2f %10.2f %10.2f\n',B');
fclose(fid);
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Data finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!