inputing ascii to grid series automatically

-ilmu mah Jangan ditahan-tahan, dibagi-bagi-

% contoh ekstraksi data netcdf dari ncep
% modified from Agus Setiawan (2007)
% by Ahmy Yulrizka feat. Putri Handayani - 2011

clear all
close all

%indramayu
kolom_awal = 58; %lon_west 106.875
kolom_akhir = 60; %lon_east 110.625
baris_awal = 49; %lat_north = -2.8571
baris_akhir = 51; %lat_south = -6.6666

% buka file data angin komponen utara-selatan
nc=netcdf('d:\cobamanual\matlab\vwnd.10m.gauss.2010.nc','nowrite');

% baca faktor skala dan offset
scalef=nc{'vwnd'}.scale_factor(:);
addoff=nc{'vwnd'}.add_offset(:);

t=1460;

fileId = fopen('d:\cobamanual\matlab\2010_1460_v.dat', 'w');

for i=1:t
disp(sprintf('proses data: %d',i))
fprintf(fileId, '"tstep" %d "item" 1 "layer" 0\n',i);
v_wind_indr = nc{'vwnd'}(i,baris_awal:baris_akhir, kolom_awal:kolom_akhir).*scalef+addoff;
for i=1:size(v_wind_indr,1)
for j=1:size(v_wind_indr,2)
fprintf(fileId, '%f ',v_wind_indr(i,j));
end
fprintf(fileId, '\n');
end
fprintf(fileId, '\n');
end

fclose(fileId);

%untuk komponen u: tinggal buka file komponen u. trus v nya di ganti u
%output ga kebalik lagi lintangnya :D
%untuk masuk ke grid series, tinggal tambahin header di dlm ascii filenya
%cara nulis header ada di mike
%contoh header :
"Title" "Kec arah v"
"Dim" 2
"Geo" "UTM-49" 106.8750 -6.6666 0
"Time" "EqudistantTimeAxis" "2010-01-01" "00:00:00" 1460 21600
"NoGridPoints" 3 3
"Spacing" 208125 211344
"NoStaticItems" 0
"NoDynamicItems" 1
"Item" "v-Velocity" "v-Velocity" "m/s"
NoCustomBlocks 1
"M21_Misc" 1 7 0 0 0 0 0 0 0
"Delete" -1E-030
"DataType" 0
%tinggal ctrl+n di mike -> grid series -> browse file ascii yg udah dipake header
%inget-inget waktunya masih UTC
%Good Luck

-------------------That would be all------------------

meirita ,, baca yaks,, kalo ada ide yg lebih oke ttg ini, tell me tell me okayyy

Thx to (so much) : Abicki