convert IDL code to matlab?

조회 수: 4 (최근 30일)
ALI HADDACH
ALI HADDACH 2020년 7월 7일
Hey, I'm trying to convert a IDL code to matlab, in fact i have a idl code in which it creats a bathymetry file .bot (means that the file.bot contain a value of bathymetry but in meshs). Hope you understand me, i will let my code here so you can check it.
;pro to format the bathymetric data for swan use
device, true=24, decomposed=0, retain=2
!P.BACKGROUND=255
tek_color & black=0 & white=1 & red=2 & green=3 & dk_blue=4 & lt_blue=5 & pink=6 & yellow=7 & orange=8 & md_blue=11 & dk_grey=14 & lt_grey=15
bathy_file='/data/Etudiants_encadrement/Etudiants_Mordane/Lahcen_Benya/emodnet_mean_TEST.asc'
headers=6
delimiter=' '
bathy=read_ascii(bathy_file, data_start=headers,delimiter=delimiter)
bathy=bathy.(0)
data_size=size(bathy)
x_size=data_size(1)
y_size=data_size(2)
!order=1
lodct=13
stop
;window,xsize=650,ysize=y_size
;tv,bathy[0:649,*]
meshes=167
nb_meshes=1
new_tab=fltarr(167,y_size)
new_tab=bathy[0:166,*]
;stop
;window,xsize=650,ysize=y_size
index_nan=where(new_tab le -32767)
new_tab(index_nan)=!values.f_NaN
formated_table_bath=fltarr(meshes,y_size*nb_meshes)
;stop
Tab_tmp=fltarr(meshes,1)
for i=0,nb_meshes-1 do begin
j=0
for row=0,y_size-1 do begin
j=j+1
;for col=meshes*i,meshes*(i+1)-1 do begin
formated_table_bath(*,j*(i+1)-1)=string(new_tab(meshes*i:meshes*(i+1)-1,row),format='(f10.3)')
print,new_tab(meshes*i:meshes*(i+1)-1,row)
print,formated_table_bath(*,0)
;stop
;endfor
;print,new_tab(meshes*i:meshes*(i+1)-1,row)
;stop
endfor
endfor
Bathy_with_blanc=fltarr(170,y_size*nb_meshes)
Bathy_with_blanc(*,*)=999.999;!values.f_NaN
Bathy_with_blanc(0:meshes-1,0:y_size*nb_meshes-1)=formated_table_bath(*,*)
help,formated_table_bath
;stop
file_formated_bathy_tarfaya='/data/Etudiants_encadrement/Etudiants_Mordane/Lahcen_Benya/emodnet_format_lahcen_new_one.txt'
openw,1,file_formated_bathy_tarfaya
printf,1,'NCOLS 160 NROWS 76 XLLCORNER -8.712158203125 YLLCORNER 33.14849853515625'
printf,1,'CELLSIZE 0.002083333333299996'
printf,1,'NODATA_VALUE -32767.0'
printf,1,Bathy_with_blanc,format='(10(f10.3,1x))'
close,1
;tv,new_tab
;stop
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by