Changeset 526 for trunk/src/get_field.m


Ignore:
Timestamp:
Aug 20, 2012, 12:32:31 PM (12 years ago)
Author:
sommeria
Message:

bugs corrected; Posiibility of usual 1D plots introduced with the new way of using get_field. time_series and aver_stat updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/get_field.m

    r521 r526  
    831831function RUN_Callback(hObject, eventdata, handles)
    832832%---------------------------------------------------------
    833 % set(handles.RUN,'BackgroundColor',[1 1 0])% mark use of RUN action
    834 % test_fig=get(handles.SelectFigure,'Value');
    835 %
    836 % % plot requested in uvmat
    837 % if ~test_fig
    838 %     inputfile=get(handles.inputfile,'String');
    839 %     huvmat=findobj(allchild(0),'tag','uvmat');
    840 %     if isempty(huvmat)
    841 %         input.InputFile=inputfile;
    842 %         input.FieldsString={'get_field...'};
    843 %         uvmat(input)
    844 %     else
    845 %         set(huvmat,'Visible','on')%make uvmat visible (bugs can hide it in some cases)
    846 %         hhuvmat=guidata(huvmat);
    847 %         set(hhuvmat.Fields,'Value',1)
    848 %         set(hhuvmat.Fields,'String',{'get_field...'})
    849 %         uvmat('run0_Callback',hObject,eventdata,hhuvmat); % display field in uvmat
    850 %     end
    851 %   
    852 % % other kind of plot
    853 % else  %TODO: check and update: add plot on an existing axes
    854 %     figcell=get(handles.list_fig,'String');
    855 %     index=get(handles.list_fig,'value');
    856 %     figstring=figcell{index};
    857 %     index=get(handles.ACTION,'Value');
    858 %     list_func=get(handles.ACTION,'UserData');
    859 %     h_fun=list_func{index};
    860 %     set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784])
    861 %     drawnow
    862 %     SubField=h_fun(handles.get_field);%handles.figure1 =handles of the GUI get_field
    863 %     if ~isempty(SubField)
    864 %         plot_get_field(SubField,handles)
    865 %     end
    866 %     browse_fig(handles.list_fig); %update the list of new existing figures
    867 % end
    868 % set(handles.RUN,'BackgroundColor',[1 0 0])
     833hfield=[];
    869834huvmat=findobj(allchild(0),'tag','uvmat');
    870 hhuvmat=guidata(huvmat);
    871 FieldsMenu=get(hhuvmat.Fields,'String');
    872 Fields=FieldsMenu{get(hhuvmat.Fields,'Value')};
    873 check_first=strcmp(Fields,'get_field...'); % =1 if the first field sereis is selected, =0 else
     835hseries=findobj(allchild(0),'tag','series');
     836check_series=0;
    874837if ~isempty(huvmat)
    875          get_field_GUI=read_GUI(handles.get_field);
    876          if isfield(get_field_GUI,'PanelVectors')
    877              set(hhuvmat.Coord_x,'value',1)
    878              set(hhuvmat.Coord_y,'value',1)
    879              set(hhuvmat.Coord_x,'String',{get_field_GUI.PanelVectors.coord_x_vectors})
    880              set(hhuvmat.Coord_y,'String',{get_field_GUI.PanelVectors.coord_y_vectors})
    881              UName=get_field_GUI.PanelVectors.vector_x;
    882              VName=get_field_GUI.PanelVectors.vector_y;
    883              menu_str=[{['vec(' UName ',' VName ')']};{UName};{VName};{['norm(' UName ',' VName ')']};{'get_field...'}];
    884              menu_color=[{''};{UName};{VName};{['norm(' UName ',' VName ')']}];
    885              if check_first
    886                   set(hhuvmat.Fields,'Value',1)
    887                  set(hhuvmat.Fields,'String',menu_str)
    888              else %get_field has been called by Fields_1
    889                   set(hhuvmat.Fields_1,'Value',1)
    890                  set(hhuvmat.Fields_1,'String',menu_str)
    891              end
    892              ind_menu=find(strcmp(get_field_GUI.PanelVectors.vec_color,menu_color));
    893              if ~isempty(ind_menu)
    894              set(hhuvmat.ColorScalar,'Value',ind_menu)
    895              else
    896                  set(hhuvmat.ColorScalar,'Value',1)
    897              end
    898                set(hhuvmat.ColorScalar,'String',menu_color)
    899          elseif isfield(get_field_GUI,'PanelScalar')
    900              set(hhuvmat.Coord_x,'value',1)
    901              set(hhuvmat.Coord_y,'value',1)
    902              set(hhuvmat.Coord_x,'String',{get_field_GUI.PanelScalar.coord_x_scalar})
    903              set(hhuvmat.Coord_y,'String',{get_field_GUI.PanelScalar.coord_y_scalar})
    904              AName=get_field_GUI.PanelScalar.scalar;
    905              if check_first
    906                 menu=get(hhuvmat.Fields,'String');
    907              else
    908                 menu=get(hhuvmat.Fields_1,'String');
    909              end
    910              ind_select=find(strcmp(AName,menu));
    911              if isempty(ind_select)
    912                  menu=[menu(1:end-1);{AName};{'get_field...'}];
    913                  ind_select=numel(menu)-1;
    914              end   
    915              if check_first
    916                 set(hhuvmat.Fields,'Value',ind_select);
    917                 set(hhuvmat.Fields,'String',menu);
    918              else
    919                 set(hhuvmat.Fields_1,'Value',ind_select);
    920                 set(hhuvmat.Fields_1,'String',menu);
    921              end
    922          end
    923          if ~strcmp(get(gcbf,'tag'),'uvmat')%if uvmat is not already active
    924          uvmat('run0_Callback',hObject,eventdata,hhuvmat); %refresh uvmat
    925          end
     838    hh=guidata(huvmat);
     839    FieldMenu=get(hh.FieldName,'String');
     840    FieldName=FieldMenu{get(hh.FieldName,'Value')};
     841    if strcmp(FieldName,'get_field...')
     842        hfield=hh.FieldName; %FieldName on uvmat
     843    elseif strcmp(get(hh.FieldName_1,'Visible'),'on')
     844        FieldMenu=get(hh.FieldName_1,'String');
     845        if ~isempty(FieldMenu)
     846            FieldName=FieldMenu{get(hh.FieldName_1,'Value')};
     847            if strcmp(FieldName,'get_field...')
     848                hfield=hh.FieldName_1; %FieldName_1 on uvmat
     849            end
     850        end
     851    end
     852end
     853if isempty(hfield) && ~isempty(hseries)
     854    check_series=1;
     855        hh=guidata(hseries);
     856    FieldMenu=get(hh.FieldName,'String');
     857    FieldName=FieldMenu{get(hh.FieldName,'Value')};
     858    if strcmp(FieldName,'get_field...')
     859        hfield=hh.FieldName; %FieldName on series
     860    else
     861       FieldMenu=get(hh.FieldName_1,'String');
     862       FieldName=FieldMenu{get(hh.FieldName_1,'Value')};
     863       if strcmp(FieldName,'get_field...')
     864            hfield=hh.FieldName_1; %FieldName_1 on series
     865       end
     866    end
     867end
     868if ~isempty(hfield)
     869    get_field_GUI=read_GUI(handles.get_field);
     870    if isfield(get_field_GUI,'PanelVectors')
     871        set(hh.Coord_x,'value',1)
     872        set(hh.Coord_y,'value',1)
     873        set(hh.Coord_x,'String',{get_field_GUI.PanelVectors.coord_x_vectors})
     874        set(hh.Coord_y,'String',{get_field_GUI.PanelVectors.coord_y_vectors})
     875        UName=get_field_GUI.PanelVectors.vector_x;
     876        VName=get_field_GUI.PanelVectors.vector_y;
     877        menu_str=[{['vec(' UName ',' VName ')']};{UName};{VName};{['norm(' UName ',' VName ')']};{'get_field...'}];
     878        menu_color=[{''};{UName};{VName};{['norm(' UName ',' VName ')']}];
     879        set(hfield,'Value',1)
     880        set(hfield,'String',menu_str)
     881        if ~check_series
     882            ind_menu=find(strcmp(get_field_GUI.PanelVectors.vec_color,menu_color));
     883            if ~isempty(ind_menu)
     884                set(hh.ColorScalar,'Value',ind_menu)
     885            else
     886                set(hh.ColorScalar,'Value',1)
     887            end
     888            set(hh.ColorScalar,'String',menu_color)
     889        end
     890    elseif isfield(get_field_GUI,'PanelScalar')
     891        set(hh.Coord_x,'value',1)
     892        set(hh.Coord_y,'value',1)
     893        set(hh.Coord_x,'String',{get_field_GUI.PanelScalar.coord_x_scalar})
     894        set(hh.Coord_y,'String',{get_field_GUI.PanelScalar.coord_y_scalar})
     895        AName=get_field_GUI.PanelScalar.scalar;
     896        menu=get(hfield,'String');
     897        ind_select=find(strcmp(AName,menu));
     898        if isempty(ind_select)
     899            menu=[menu(1:end-1);{AName};{'get_field...'}];
     900            ind_select=numel(menu)-1;
     901        end
     902        set(hfield,'Value',ind_select);
     903        set(hfield,'String',menu);
     904    elseif isfield(get_field_GUI,'Panel1Dplot')
     905        set(hh.Coord_x,'Value',1)
     906        set(hh.Coord_x,'String',{get_field_GUI.Panel1Dplot.abscissa})
     907        set(hh.Coord_y,'String',{get_field_GUI.Panel1Dplot.ordinate})
     908        set(hh.Coord_y,'Value',1:numel(get_field_GUI.Panel1Dplot.ordinate))
     909        set(hfield,'Value',1)
     910        set(hfield,'String',[{''};{'get_field...'}])
     911    end
     912    if  ~check_series && strcmp(get(gcbf,'tag'),'get_field')%get_field is not called by another GUI (uvmat)
     913        uvmat('run0_Callback',hObject,eventdata,hh); %refresh uvmat
     914    end
    926915end
    927916delete(handles.get_field)
    928 %         set(hhuvmat.Fields,'String',{'get_field...'})
    929 %         uvmat('run0_Callback',hObject,eventdata,hhuvmat); % display field in uvmat
    930 %     end
    931917
    932918%------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.