📄 fm_plot.m
字号:
valori = get(Hdl_listvar,'Value'); val = valori(Varname.po(value)); stringa = get(Fig.plot,'UserData'); nomeattuale = popupstr(Hdl_listplot); idx = findstr(nomeattuale,']'); nomeattuale = nomeattuale(idx+2:end); nomenuovo = fm_input('Input Formatted Text:', ... 'Legend Name',1,{stringa{val}}); if isempty(nomenuovo), return, end Varname.changes(val) = 1; stringa{val} = nomenuovo{1}; set(Fig.plot,'UserData',stringa); fm_disp(['Formatted text of variable "', ... nomeattuale,'" has been changed in "', ... nomenuovo{1},'"']) else fm_disp('No variable selected') endcase 5 if Settings.zoom xy = get(Fig.plot,'CurrentPoint'); if xy(1) > 0.0616 & xy(1) < 0.5644 & xy(2) > 0.4190 & xy(2) < 0.9098 set(Fig.plot,'Pointer','crosshair'); eval(Settings.zoom) elseif xy(1) > 0.0638 & xy(1) < 0.2329 & xy(2) > 0.0663 & xy(2) < 0.2265 set(Fig.plot,'Pointer','arrow'); zoom off else set(Fig.plot,'Pointer','arrow'); eval(Settings.zoom) end set(Fig.plot,'WindowButtonMotionFcn','fm_plot(5)'); refreshfcn return endcase 6 zoom yon set(Fig.plot,'WindowButtonMotionFcn','fm_plot(5)'); set(hdl_zoom1,'Value',0); set(hdl_zoom2,'Value',0); if get(hdl_zoom3,'Value') Settings.zoom = 'zoom yon'; else Settings.zoom = ''; zoom off endcase 7 if get(hdl_x,'Value') set(hdl_x,'Value',0) delete(findobj(allchild(hdlfig),'UserData','x axis')) end if get(hdl_xy,'Value') set(hdl_xy,'Value',0) delete(findobj(allchild(hdlfig),'UserData','x axis')) delete(findobj(allchild(hdlfig),'UserData','y axis')) end value = get(gcbo,'Value'); if value ylim = get(hdlfig,'YLim'); hold on h = plot([0 0],[ylim(1), ylim(2)],'k:'); set(h,'UserData','y axis') hold off else hdl_child = allchild(hdlfig); delete(findobj(hdl_child,'UserData','y axis')) end if Fig.line, fm_plot(19), endcase 8 currentColor = get(hdlfig,'Color'); c = uisetcolor(currentColor); if ~isequal(c,currentColor) set(hdlfig,'Color',c); hdl_line = findobj(allchild(hdlfig),'Type','line'); set(hdl_line,'MarkerFaceColor',c) hlegend = findobj(Fig.plot,'Tag','legend'); set(hlegend,'Color',c) endcase 9 if get(hdl_y,'Value') set(hdl_y,'Value',0) delete(findobj(allchild(hdlfig),'UserData','y axis')) end if get(hdl_xy,'Value') set(hdl_xy,'Value',0) delete(findobj(allchild(hdlfig),'UserData','y axis')) delete(findobj(allchild(hdlfig),'UserData','x axis')) end value = get(gcbo,'Value'); if value xlim = get(hdlfig,'XLim'); hold on h = plot([xlim(1), xlim(2)], [0, 0],'k:'); set(h,'UserData','x axis') hold off else hdl_child = allchild(hdlfig); delete(findobj(hdl_child,'UserData','x axis')) end if Fig.line, fm_plot(19), endcase 10 if get(hdl_x,'Value') set(hdl_x,'Value',0) delete(findobj(allchild(hdlfig),'UserData','x axis')) end if get(hdl_y,'Value') set(hdl_y,'Value',0) delete(findobj(allchild(hdlfig),'UserData','y axis')) end value = get(gcbo,'Value'); if value xlim = get(hdlfig,'XLim'); ylim = get(hdlfig,'YLim'); hold on h = plot([xlim(1), xlim(2)], [0, 0],'k:'); set(h,'UserData','x axis') h = plot([0, 0],[ylim(1), ylim(2)],'k:'); set(h,'UserData','y axis') hold off else hdl_child = allchild(hdlfig); try, delete(findobj(hdl_child,'UserData','x axis')), end try, delete(findobj(hdl_child,'UserData','y axis')), end end if Fig.line, fm_plot(19), endcase 11 zoom xon set(Fig.plot,'WindowButtonMotionFcn','fm_plot(5)'); set(hdl_zoom1,'Value',0); set(hdl_zoom3,'Value',0); if get(hdl_zoom2,'Value') Settings.zoom = 'zoom xon'; else Settings.zoom = ''; zoom off endcase 12 zoom on set(Fig.plot,'WindowButtonMotionFcn','fm_plot(5)'); set(hdl_zoom2,'Value',0); set(hdl_zoom3,'Value',0); if get(hdl_zoom1,'Value') Settings.zoom = 'zoom on'; else Settings.zoom = ''; zoom off endcase 13 value = get(Hdl_listplot,'Value'); NameString = get(Hdl_listplot,'String'); Value = 1:length(NameString); if value > 1 dummy = Varname.po(value); Varname.po(value) = Varname.po(value-1); Varname.po(value-1) = dummy; dummy = Value(value); Value(value) = Value(value-1); Value(value-1) = dummy; set(Hdl_listplot, ... 'String',NameString(Value), ... 'Value',value-1); endcase 14 value = get(Hdl_listplot,'Value'); NameString = get(Hdl_listplot,'String'); Value = 1:length(NameString); if value < length(Varname.po) & ~isempty(NameString) dummy = Varname.po(value); Varname.po(value) = Varname.po(value+1); Varname.po(value+1) = dummy; dummy = Value(value); Value(value) = Value(value+1); Value(value+1) = dummy; set(Hdl_listplot, ... 'String',NameString(Value), ... 'Value',value+1); endcase 15 if get(gcbo,'Value'), grid on, else, grid off, endcase 16 if Settings.hostver >= 7 legend(Hdl.axesplot,'toggle') else onoff = {'off','on'}; if strcmp(get(gcbo,'Tag'),'PushLegend') set(Hdl_legend,'Value',~get(Hdl_legend,'Value')) set(gcbo,'Checked',onoff{get(Hdl_legend,'Value')+1}) value = get(Hdl_legend,'Value'); else hdl = findobj(Fig.plot,'Tag','PushLegend'); set(hdl,'Checked',onoff{get(gcbo,'Value')+1}) value = get(gcbo,'Value'); end if value, fm_plot(1), else, legend off, end end case 17 Value = get(gcbo,'Value'); NameString = get(gcbo,'String'); set(Hdl_listplot,'String',NameString(Value)); set(Hdl_listplot,'Value',1); Varname.po = 1:length(Value); if strcmp(get(Fig.plot,'SelectionType'),'open'), fm_plot(1), endcase 18 hdl = findobj(Fig.line,'Tag','Listbox1'); Value = get(hdl,'Value'); hdl_line = get(Fig.line,'UserData'); hdl_line = hdl_line(end:-1:1); n_var = length(get(Hdl_listplot,'String')); fm_linedlg(hdl_line(Value))case 19 hdl_line = findobj(allchild(hdlfig),'Type','line'); variabili = get(Hdl_listplot,'String'); set(Fig.line,'UserData',hdl_line); hdl_list = findobj(Fig.line,'Tag','Listbox1'); line_string = cell(length(hdl_line),1); hdl_line = hdl_line(end:-1:1); for i = 1:length(hdl_line) if strcmp(get(hdl_line(i),'UserData'),'x axis') line_string{i,1} = ['x axis ',fvar(i,4)]; elseif strcmp(get(hdl_line(i),'UserData'),'y axis') line_string{i,1} = ['y axis ',fvar(i,4)]; elseif i <= length(variabili) line_string{i,1} = ['line ',fvar(i,4),variabili{i}]; else line_string{i,1} = ['symbol ',fvar(i,4), ... variabili{i-length(variabili)}]; end end set(hdl_list,'String',line_string,'Value',1);case 20 fm_axesdlg(hdlfig)case 21 TextProp = uisetfont; if isstruct(TextProp) set(hdlfig,TextProp) set(get(hdlfig,'XLabel'),TextProp) set(get(hdlfig,'YLabel'),TextProp) set(get(hdlfig,'Title'),TextProp) if get(Hdl_legend,'Value') hlegend = findobj(Fig.plot,'Tag','legend'); hchild = get(hlegend,'Child'); set(hchild(end), ... 'FontName',TextProp.FontName, ... 'FontWeight', TextProp.FontWeight, ... 'FontAngle',TextProp.FontAngle) end end case 22 first = strrep(Settings.xlabel,'\',''); hdl = findobj(Fig.plot,'Tag','Listbox1'); stringa = get(hdl,'String'); if ~isempty(stringa) set(gcbo,'String',[{first}; stringa],'Enable','on') end case 23 value = get(gcbo,'Value'); set(gcbo,'Value',value(end)) if strcmp(get(Fig.plot,'SelectionType'),'open') fm_plot(1) endendif ~isempty(Settings.zoom) eval(Settings.zoom) set(Fig.plot,'WindowButtonMotionFcn','fm_plot(5)');endrefreshfcn% ------------------------------------------------------------------------% Enumeration of variables% ------------------------------------------------------------------------function stringa = enum(stringa)for i = 1:length(stringa), stringa{i} = ['[',int2str(i),'] ',stringa{i}];end% ------------------------------------------------------------------------% Refresh WindowButtonDownFcn and WindowButtonMotionFcn% ------------------------------------------------------------------------function refreshfcn% this fixes what seems to be a bug of the "zoom" function% which delete WindowButtonDownFcn and WindowButtonMotionFcn% callbacks of other open windows...global Figif Fig.about, set(Fig.about,'WindowButtonDownFcn','fm_about aboutdown', ... 'WindowButtonMotionFcn','fm_about aboutmove')endif Fig.author set(Fig.author,'WindowButtonDownFcn','close(gcf)')endif Fig.clock set(Fig.clock,'WindowButtonDownFcn', ... 'set(Fig.clock,''Userdata'',-1)')endif Fig.comp set(Fig.comp,'WindowButtonDownFcn','fm_component cbdown', ... 'WindowButtonMotionFcn','fm_component cbmotion')endif Fig.main set(Fig.main,'WindowButtonDownFcn','fm_main buttondown', ... 'WindowButtonMotionFcn','fm_main buttonmotion')endif Fig.simset set(Fig.simset,'WindowButtonDownFcn','fm_simset buttondown', ... 'WindowButtonMotionFcn','fm_simset buttonmotion')endif Fig.update set(Fig.update,'WindowButtonDownFcn','fm_update author')end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -