📄 edit_mfile.m
字号:
function edit_mfile(fname)%EDIT_MFILE - Display an Mfile in a scrolling text window.%% EDIT_MFILE(FNAME)%% inputs:% FNAME - Is the file name to display.%% Without arguments ask for the filename using the uigetfile% and pointing to the AlexDir directory.%% Claudio 2 Oct. 1995%%% Copyright (c) 1995 by Claudio Rivetti and Mark Young% claudio@alice.uoregon.edu, mark@alice.uoregon.edu%global Uibgcolor mfilelist AlexDir Pt_mfilelist mprevb mnextbc=screencenter;if nargin==1 fname=strrep(fname, ' ', ''); if isempty(find(fname=='/')) S=readstr([AlexDir fname]); else S=readstr(fname); endelse [fname, p]=uigetfile([AlexDir '*.m'],'Mfile Index',c(1)-200, c(2)-200); if fname==0 | isempty(fname) return; else S=readstr([p fname]); endendoldf=findobj(0, 'name', 'Mfile Visualizer');if ~isempty(oldf) figure(oldf); if gco ~= mprevb & gco ~= mnextb mfilelist=str2mat(mfilelist, [p fname]); Pt_mfilelist=size(mfilelist,1); end scrledit('close', get(oldf,'userdata')); scred=scrledit('init',[0 0.2 0.97 .8], S, [p fname]); set(oldf, 'userdata', scred);else mfilelist=[p fname]; Pt_mfilelist=1; pos=[c(1)-800/2 c(2)-650/2 800 650]; fig_ed=figure('pos',pos,'Name','Mfile Visualizer','color',Uibgcolor,'Numb','off'); scred=scrledit('init',[0 0.2 0.97 .8], S, [p fname]); set(fig_ed, 'userdata', scred); uicontrol(fig_ed, 'style', 'frame',... 'units', 'normalized',... 'pos', [0.02 0.02 0.96 0.16],... 'background', Uibgcolor); okb=uicontrol(fig_ed, 'style', 'push',... 'units', 'normalized',... 'pos', [0.675 0.06 0.1 0.06],... 'horiz', 'center',... 'string', 'Close',... 'Callback', 'close(gcf);'); mprevb=uicontrol(fig_ed, 'style', 'push',... 'units', 'normalized',... 'pos', [0.375 0.06 0.1 0.06],... 'horiz', 'center',... 'string', 'Previous',... 'Callback', 'global Pt_mfilelist mfilelist;Pt_mfilelist=Pt_mfilelist-1;edit_mfile(mfilelist(Pt_mfilelist,:));'); mnextb=uicontrol(fig_ed, 'style', 'push',... 'units', 'normalized',... 'pos', [0.525 0.06 0.1 0.06],... 'horiz', 'center',... 'string', 'Next',... 'Callback', 'global Pt_mfilelist mfilelist;Pt_mfilelist=Pt_mfilelist+1;edit_mfile(mfilelist(Pt_mfilelist,:));'); indexb=uicontrol(fig_ed, 'style', 'push',... 'units', 'normalized',... 'pos', [0.225 0.06 0.1 0.06],... 'horiz', 'center',... 'string', 'Index',... 'Callback', 'edit_mfile;'); endif Pt_mfilelist==1 set(mprevb, 'Enable', 'off');else set(mprevb, 'Enable', 'on');endif Pt_mfilelist==size(mfilelist,1) set(mnextb, 'Enable', 'off');else set(mnextb, 'Enable', 'on');endreturn
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -