% 'FFT': calculate and display spectrum of the field selected in the GUI get_field % GUI_input=FFT(hget_field) % % OUTPUT: % GUI_input: option for display in the GUI get_field % %INPUT: % hget_field: handles of the GUI get_field % function DataOut=signal_FFT(DataIn) % global spec x_vec % %requests for the visibility of input windows in the GUI series (activated directly by the selection in the menu ACTION) % if ~exist('hget_field','var') % GUI_input={'check_1Dplot'}; % return %exit the function % end % GUI_input=[]; % %initiation % hhget_field=guidata(hget_field); % abscissa_list=get(hhget_field.abscissa,'String'); % val=get(hhget_field.abscissa,'Value'); % val=val(1); % abscissa_name=abscissa_list{val}; % ordinate_list=get(hhget_field.ordinate,'String'); % val=get(hhget_field.ordinate,'Value'); % val=val(1); %take only the first variable in the list DataOut=DataIn; ordinate_name=DataIn.ListVarName{2}; abscissa_name=DataIn.ListVarName{1}; % get variable Var= DataIn.(ordinate_name); Coord_x= DataIn.(abscissa_name); np=size(Var); np_freq=floor(np(1)/2); dx=1;%default dfreq=1/np(1);%default frequency interval (abscissa= array index) sum_data=sum(Var,2); ind_select=find(~isinf(Coord_x)&~isnan(sum_data));%detect infinite values Coord_x=Coord_x(ind_select); Var=Var(ind_select,:); diff_x=diff(Coord_x); dx=min(diff_x); %interpolate on a regular abscissa interval if needed if (max(diff_x)-dx)> 0.001*dx || numel(ind_select)