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

📄 combtnd.m

📁 经典通信系统仿真书籍《通信系统与 MATLAB (Proakis)》源代码
💻 M
字号:
function combtnd(bt_flag, frm_handle)
%

%       Copyright (c) 1995-96 by The MathWorks, Inc.
%       $Revision: 1.1 $  $Date: 1996/04/01 17:52:50 $

if nargin < 2
    error('There must be two input varibales in calling COMBTND.')
end;

% find the origination of the button down.
x = get(gcf, 'currentpoint');
pos_t_x = [.9 1];
pos_t_y = [0, 1];
pos_r_x = [1/5-0.07, 1];
pos_r_y = [0 .061 .063 .124 .126 .187 .189 .25]+.103;
pos_w_x = [0 1] *.15+ .73;
pos_w_y = [0 1]*.08+.01;
if x(1) < pos_r_x(1)
    return;
elseif x(2) > max(pos_r_y)
    return;
elseif (x(2) < min(pos_r_y)) & (x(1) < pos_w_x(1))
    return
else
    handle = get(gcf, 'UserData');
    if ~isempty(handle)
        data_h = handle(60:63);
        load_save = handle(64:67);
        bar_color = handle(68);
    else
        error('The handle is destroyed. Close the window and open again.');
    end;
    if (x(2) <= .1) & (x(1) >= .9)
        %trash
        return
        % currently, this doing nothing.
    elseif (x(2) >= pos_r_y(7))
        % record 1
        frm_handle = data_h(1);
        fram = [pos_r_x; pos_r_y(7:8)];
    elseif (x(2) >= pos_r_y(5))
        % record 2
        frm_handle = data_h(2);
        fram = [pos_r_x; pos_r_y(5:6)];
    elseif (x(2) >= pos_r_y(3))
        % record 3
        frm_handle = data_h(3);
        fram = [pos_r_x; pos_r_y(3:4)];
    elseif (x(2) >= pos_r_y(1))
        % current computation data
        frm_handle = data_h(4);
        fram = [pos_r_x; pos_r_y(1:2)];
    elseif (x(1) >= pos_w_x(1)) & (x(1) <= pos_w_x(2))...
         & (x(2) >= pos_w_y(1)) & (x(2) <= pos_w_y(2))
        frm_handle = -1;
        fram = [pos_w_x; pos_w_y];
    else
        return;
    end;
    selection_type = get(gcf,'selectiontype');
    set(bar_color, 'Visible','on','String','Coping or remove data record...')
    drawnow

    % set the button moving function.
    set(gcf,'unit','pixel');
    pos = get(gcf, 'position');
    fram(1,:) = fram(1,:)*pos(3);
    fram(2,:) = fram(2,:)*pos(4);

    % set the button up function.
    dragrect([fram(1,1), fram(2,1), fram(1,2)-fram(1,1), fram(2,2)-fram(2,1)]);

    set(gcf, 'unit', 'norm');
    % button up flag

    x = get(gcf, 'currentpoint');

    if (x(2) <= .1) & (x(1) >= .9)
        %trash
        if (frm_handle > 0)
            set(frm_handle,'UserData',[],...
               'Visible','off');
        end;
    elseif (x(2) >= pos_r_y(7)) & (x(1) > pos_r_x(1))
        % record 1
        to_handle = data_h(1);
    elseif (x(2) >= pos_r_y(5)) & (x(1) > pos_r_x(1))
        % record 2
        to_handle = data_h(2);
    elseif (x(2) >= pos_r_y(3)) & (x(1) > pos_r_x(1))
        % record 3
        to_handle = data_h(3);
    elseif (x(2) >= pos_r_y(1)) & (x(1) > pos_r_x(1))
        % current computation data
        to_handle = data_h(4);
    elseif (x(1) >= pos_w_x(1)) & (x(1) <= pos_w_x(2))...
        & (x(2) >= pos_w_y(1)) & (x(2) <= pos_w_y(2))
        to_handle = 0;
        if frm_handle ~= -1;
            % open a window inputting put xx into
            % snr and ber variables
            xx=get(frm_handle, 'UserData');
            % write xx(1,:) to snr
            % write xx(2,:) to ber
            %%%%%%%%%%%%%%
            comwksp(1, xx);
        end;
    else
        to_handle = 0;
    end;
    if to_handle
       if frm_handle > 0
          set(to_handle, 'UserData', get(frm_handle,'UserData'),...
              'Visible', 'on',...
              'String', get(frm_handle,'String'));
       else
           % open a window outputting snr and ber variable name into 
           % to_handle userdata and string
           %%%%%%%%%%%%%%
           comwksp(0, to_handle);
       end;
    end;
    set(bar_color, 'Visible','off','String','Loading setup, please wait...')
end;

⌨️ 快捷键说明

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