?? fm_simsave.m
字號:
function fm_simsave(varargin)% FM_SIMSAVE attempts to save the current Simulink model to% Simulink 3 (R11) or, if it is not possible, to the% oldest supported Simulink release.%% This functions calls UIGETFILE to chose a Simulink% model. At the end of the procedure, the original file% will subsituted with the new one.%%Author: Federico Milano%Date: 07-Aug-2003%Version: 1.0.0%%E-mail: fmilano@thunderbox.uwaterloo.ca%Web-site: http://thunderbox.uwaterloo.ca/~fmilano%% Copyright (C) 2002-2005 Federico Milano%% This toolbox is free software; you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation; either version 2.0 of the License, or% (at your option) any later version.%% This toolbox is distributed in the hope that it will be useful, but% WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANDABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU% General Public License for more details.%% You should have received a copy of the GNU General Public License% along with this toolbox; if not, write to the Free Software% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,% USA.global Path Settingsif Settings.hostver < 6 fm_choice('This function runs only under Matlab 6.x or newer',2) fm_disp('This function runs only under Matlab 6.x or newer') returnendswitch nargin case 0, [filename, pathname] = uigetfile('*.mdl', ... 'Chose Simulink Model...'); case 1, if ~strcmp(varargin{1},'all'), return, end foldername = uigetdir(Path.local) a = dir([foldername,filesep,'*.mdl']); names = {a.name} for i = 1:length(names) fm_simsave(names{i},foldername); end return otherwise, filename = varargin{1}; pathname = varargin{2};endif isequal(pathname,0), return, endmodelname = strrep(filename,'.mdl','');currentpath = pwd;cd(pathname)if Settings.hostver >= 7 fm_disp(['Model ', modelname,' will be saved in Simulink 4 (R12) format.']) load_system(modelname); save_system(modelname,modelname,'','R12');else % Matlab version < 7 fm_disp(['Model ', modelname,' will be saved in Simulink 3 (R11) format.']) if exist(filename) == 4 fm_disp(['Create dummy file ',modelname,'_53.mdl ...']) if Settings.hostver == 6.5 slsaveas(modelname,[modelname,'_53'],'SaveAsR11'); else slsaveas(modelname,[modelname,'_53']); end else fm_disp('The selected file is not a Simulink model ...') end fm_disp(['Replacing ',modelname,'_53.mdl with ',modelname,'.mdl ...']) [s,m1,m2] = copyfile([modelname,'_53.mdl'],[modelname,'.mdl'],'f'); if ~s fm_disp(m1) fm_disp(m2) else delete([modelname,'_53.mdl']) fm_disp([modelname,'.mdl converted.']) end endcd(currentpath)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -