MATLAB脚本——自动查找未连接的scope

function varargout = A_FindUnconScope(varargin)
gui_Singleton = 1;
gui_State = ('gui_Name',       mfilename,...
             'gui_Singleton',  gui_Singleton,...
             'gui_OpeningFcn', @A_FindUnconScope_OpeningFcn,...
             'gui_OutputFcn',  @A_FindUnconScope_OutputFcn,...
             'gui_LayoutFcn',  [],...
             'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end

function A_FindUnconScope_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);

function varargout =  A_FindUnconScope_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;

function ScopeList.Callback(hObject, eventdata, handles)
sel = get(gcf, 'selectiontype');
if strcmp(sel, 'open')
    str = get(hObject, 'string');
    n = get(hObject, 'value');
    hilite_system(str(n));
end


%----Executes on button press in button_looup.
function button_looup_Callback(hObject, eventdata, handles)
% hObject    handle to button_looup (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
Block_Handle=get_param(find_system(bdroot, 'FollowLinks','on','LookUnderMasks','all'),'Handles');
for i=2:length(Block_Handle)
    Block_type=get(Block_Handle{i},'BlockType');
    if strcmp(Block_type,'Scope')==0
        Block_Handle{i}= '';
    end
end
j=1;
for ii=2:length(Block_Handle)
    %%Scope_Ports_NumVct=get(Block_Handle{ii},'Ports');
    %%Scope_Ports_Num=Scope_Ports_NumVct(1);
    if~isempty(Block_Handle{ii})
        Scope_Ports_Connect_Struct=get(Block_Handle{ii},'PortConnectivity');
        Scope_Ports_Connect_Cell=(struct2cell(Scope_Ports_Connect_Struce))';
        ScopeUnconnect=cell2mat(Scope_Ports_Connect_Cell(:,3));
        if any(ScopeUnconnect==-1)
            AAAA{1,j}=get(Block_Handle{ii},'Path');
            AAAA{2,J}=get(Block_Handle{ii},'Name');
            AAAA{3,J}=strcat(AAAA(1,j),'/',AAAA(2,j));
            j=j+1;
        end
    end
end
if j>1
    for num=1:j-1
        AAAAA{num,1}=AAAA{3,num};
    end
   set (handles.ScopeList,'string',AAAAA);
else
    msgbox('无未连接Scope','modal');
end
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值