⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 opensb.m

📁 经典通信系统仿真书籍《通信系统与 MATLAB (Proakis)》源代码
💻 M
字号:
function err = opensb(sbfile,slfile,topblk)
%OPENSB opens ASCII SystemBuild files into SIMULINK.
%
%	OPENSB('SBFILE') opens the SystemBuild file SBFILE in a
%	SIMULINK window. If there are independent subsystems
%	contained in the file, a message prompts you to indicate
%	which subsystem(s) to open.
%
%	OPENSB('SBFILE','SLFILE') directly translates the SystemBuild 
%       file SBFILE into the SIMULINK M-file SLFILE.M. If there are 
%	independent subsystems contained in the file, a message
%	prompts you to indicate which subsystem(s) to open.
%
%	OPENSB('SBFILE','SLFILE','SUPERBLOCK') directly translates the
%	the SystemBuild subsystem SUPERBLOCK contained in SBFILE
%	into the SIMULINK M-file SLFILE.M. If SLFILE is an empty 
%	string (''), the subsystem will be opened in a SIMULINK 
%	window instead of saved as an M-file.
%
%	ERR = OPENSB('SBFILE',...) returns a 1 if the translation 
%	produces an error. A zero is returned if the translation is
%	successful.
%
%	You may be prompted to run LOAD SLFILE to load variables into the
%	workspace if there is data saved in the SystemBuild file and/or 
%	in the translation.

%	Wes Wang 12-4-92
%	Copyright (c) 1990-93 by The MathWorks, Inc.
%	$Revision: 1.10 $  $Date: 1993/10/06 19:11:18 $

if ~exist('sb2sl121')
   tmp = version;
   if (tmp(1) < '4')
      error('Translator works on MATLAB v4.0 or higher');
   end
   tmp = computer;
   if (tmp(1:2)=='PC') | (tmp(1:2)=='MA')
      error('Translator is not in your path.');
   else
      xx = path;
      ind_sim = findstr('simulink',xx);
      if isempty(ind_sim)
         error('Must be licensed for SIMULINK to use the function')
      end
      ind_col = find(xx == ':');
      while ind_col(1) < ind_sim(1)
        xx = xx(ind_col(1)+1:length(xx));
        ind_col = find(xx == ':');
        ind_sim = findstr('simulink',xx);
      end;
      xx = [xx(1:ind_sim(1)+8) 'sb2sl'];
      yy = unix(['test -d ' xx]);
      if yy
         error([xx ' does not exist in your path yet'])
      end
      path(xx,path);
   end
end;
if exist('sb2sl121')
  if nargin <=0
    disp('USAGE: opensb SystemBuildFileName')
    return
  end;
  f_sb = exist(sbfile);
  if f_sb <= 0
    error(['Cannot Open File ''' sbfile '''. Please Check Your Filename.'])
    return;
  end;
  if nargout == 0
    if nargin == 1
      eval('readsb(sbfile);')
    elseif nargin == 2
      eval('readsb(sbfile,slfile);')
    elseif nargin == 3
      eval('readsb(sbfile,slfile,topblk);')
    end;
  else
    if nargin == 1
      eval('err=readsb(sbfile);')
    elseif nargin == 2
      eval('err=readsb(sbfile,slfile);')
    elseif nargin == 3
      eval('err=readsb(sbfile,slfile,topblk);')
    end
  end
else
  error('OPENSB function is not available in your computer yet')
end;

%--end opensb.m--

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -