%%% written by Xiaoshuang Ma, Anhui University, China, in April 2018.
%%% This work should only be used for nonprofit purposes.

clc
clear all


number=input('Total frequency number: ');
L=input('Looks number: ');
win=input('Length of the side of searching window: ');
sigma=input('sigma value(0.7 or 0.8 for 1L, 0.8 or 0.9 for 4L): ');
v=input('parameter determining the weight normalization factor (suggest 0.8 or 0.9): ');

C1=IMPNLM(number,L,sigma,win,v);


  folder=uigetdir('C:\', 'Please select the C3 directory of each band');
id1=fopen(strcat(folder,'\C11.bin'),'w');id2=fopen(strcat(folder,'\C22.bin'),'w');id3=fopen(strcat(folder,'\C33.bin'),'w');
id4=fopen(strcat(folder,'\C12_real.bin'),'w');id5=fopen(strcat(folder,'\C12_imag.bin'),'w');id6=fopen(strcat(folder,'\C13_real.bin'),'w');
id7=fopen(strcat(folder,'\C13_imag.bin'),'w');id8=fopen(strcat(folder,'\C23_real.bin'),'w');id9=fopen(strcat(folder,'\C23_imag.bin'),'w');

fwrite(id1,C1(:,:,1),'float');fwrite(id2,C1(:,:,2),'float');fwrite(id3,C1(:,:,3),'float');fwrite(id4,C1(:,:,4),'float');
fwrite(id5,C1(:,:,5),'float');fwrite(id6,C1(:,:,6),'float');fwrite(id7,C1(:,:,7),'float');fwrite(id8,C1(:,:,8),'float');fwrite(id9,C1(:,:,9),'float');
 fclose('all');
 
