필터 지우기
필터 지우기

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 (최근 30일)
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개)

카테고리

Help CenterFile Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by