📄 bdwthelp.m
字号:
function bdwthelp(file_name, win_name)
%BDWTHELP Writes masked block information into file FILE_NAME.
% BDWTHELP(FILE_NAME) writes mask block information from the given file
% to the blocks of the current SIMULINK window.
%
% BDWTHELP(FILE_NAME, WIN_NAME) writes mask block information from the
% given file to the blocks of the SIMULINK window specified in WIN_NAME.
%
% See also: BDRDHELP.
% Wes Wang 10/20/95
% Copyright (c) 1995-96 by The MathWorks, Inc.
% $Revision: 1.1 $ $Date: 1996/04/01 19:31:57 $
% not enough parameter
if nargin < 1
error('Not enough parameters.')
end;
% nargin == 1 format
if nargin < 2
win_name = get_param;
if isempty(win_name)
disp('There is no SIMULINK window. Process terminated.')
return;
end;
end;
% blocks.
blks = get_param(win_name, 'blocks');
sys = [];
if isempty(blks)
sys = strtok(win_name,'/');
if isempty(sys)
disp('There is no block int he given window. Process terminated.');
return;
else
feval(sys);
blks = get_param(win_name);
end;
end
%open file
fid = fopen(file_name, 'r');
xx = setstr(fread(fid, Inf, 'char'))';
fclose(fid);
indx = find(xx==setstr(13));
xx(indx) = [];
if isempty(xx)
disp('File is empty. Process terminates.')
return;
end;
indx_x = findstr(xx, '***Name***');
xx = xx(indx_x(1)+11:length(xx));
while ~isempty(xx)
indx_x = findstr(xx, '***Name***');
if isempty(indx_x)
x = xx;
xx= [];
else
x = xx(1:indx_x(1)-2);
xx = xx(indx_x(1)+11:length(xx));
end;
indx_x = findstr(x, '***Type***');
y = x(1:indx_x(1)-2);
x = x(indx_x(1)+11:length(x));
indx_x = findstr(x, '***Dial***');
z = x(1:indx_x(1)-2);
x = x(indx_x(1)+11:length(x));
set_param([win_name '/' y], 'Mask Type', z);
indx_x = findstr(x, '***Help***');
z = x(1:indx_x(1)-2);
x = x(indx_x(1)+11:length(x));
indx = find(z==setstr(10));
z(indx) = setstr('|'*ones(1, length(indx)));
ii = 1;
if ~isempty(indx)
while (ii < length(indx)) & z(indx(ii)-1) ~= '.'
if x(indx(ii)-1) == ':'
error('Checke your format, you may have made worng expression in your dialogue box.');
end;
z = [z(1:indx(ii)-1) '\n' z(indx(ii) + 1: length(z))];
indx=indx+1;
ii = ii + 1;
end;
end;
set_param([win_name '/' y], 'Mask Dialogue', z);
indx_x = findstr(x, '***Cmds***');
z = x(1:indx_x(1)-2);
indx = find(z==setstr(10));
z(indx) = setstr(' '*ones(1,length(indx)));
indx = findstr(z,' ');
z(indx) = [];
x = x(indx_x(1)+11:length(x));
if length(z) > 439
disp(['Help string for block', setstr(10), y, setstr(10) 'is too long, which is ',num2str(length(z))]);
end;
set_param([win_name '/' y], 'Mask Help', z);
indx_x = findstr(x, '***Disp***');
z = x(1:indx_x(1)-1);
x = x(indx_x(1)+11:length(x)-1);
indx = find(x==setstr(10));
if ~isempty(indx)
for ii = indx(length(indx):-1:1)
x = [x(1:ii-1) '\n' x(ii+1:length(x))];
end;
end;
indx = find(z==setstr(10));
z(indx) = [];
set_param([win_name '/' y], 'Mask Translate', z);
set_param([win_name '/' y], 'Mask Display', x);
end;
if ~isempty(sys)
close_system(sys, 1);
end;
%--end of bdrdhelp--
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -