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

📄 trgraph.m

📁 good for who wants it
💻 M
📖 第 1 页 / 共 2 页
字号:
function varargout = trgraph(varargin)%Copyright (c) 2001-2005 by Jaroslaw Malek%All rights reserved.%Author contact: wido@o2.pl, jaroslaw_malek@interia.pl%Using version 2.03 or higher of Trace graph and its documentation%is allowed for commercial and non-commercial purposes provided that%licensee has a valid Trace graph license and the above copyright%notice and this permission appear in all copies and any materials%related to Trace graph. Trace graph (compiled and source code versions) %cannot be distributed, sold, copied or modified without%Jaroslaw Malek's permission. Any modification of the Trace graph %source code has to be sent to Jaroslaw Malek. The source code %and compiled version can be used only by one user (the licensee). %The licensee can use it only on one computer. If Trace graph %(source code or compiled version) needs to be used on more computers %or by more users, separate copies (licences) of Trace graph source %code has to be bought for each user and computer.%Trace graph is provided with no warranty. Jaroslaw Malek is not%responsible for any events and results caused by using Trace graph.% TRGRAPH Application M-file for trgraph.fig%    FIG = TRGRAPH launch trgraph GUI.%    TRGRAPH('callback_name', ...) invoke the named callback.global C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 C14 C15 C16 % trace file columnsglobal TMAX % simulation timeglobal LNOD % number of nodesglobal AKTWEZ % current nodeglobal PAKIETY % packet typesglobal STARTWEZ % other nodeglobal CHECK % if the following option are on: packet types, other node, overlay graphs,              % auto refresh graph, auto refresh information, count packets IDs only once, packet sizes, turbo modeglobal WYKRESY % graph tableglobal WYKRESTAG % tags table for graphsglobal KOLORY % colors table for graphsglobal COL % current colorglobal WYKRESLAB % graph names tableglobal LICZBAWYK % number of graphsglobal OPLIK % if open a trace file from the command lineglobal pole % packets listglobal TSTART % start timeglobal TEND % end timeglobal PLIKINT % if the trace file has been loaded with time interval [TSTART, TEND]global PREC % num2str precisionglobal NUMDELINT % number of intervals for histogramsglobal IDCOUNT % if count packets IDs only once should be included in graphs descriptionglobal DC % if direct connection should be included in graphs descriptionglobal CZY3D % if the plotted graph is 3Dglobal FWDLENGTH % lenght of string containing node number to which packets are forwarded (wireless -Hd)global TILNUM % precision to show TIL (Time Interval Length)global HISTINTERVALS % histograms intervalsglobal fig %main window referenceglobal sfig %simulation information window referenceglobal gfig %graphs window referenceglobal shandles % simulation information window referencesglobal ghandles % graphs window referencesglobal DCONLY % equals 1 if only direct connection otherwise 0global FID % flow id columnglobal FLOWID % current flow idglobal DELAY % equals 1 if delay is calculatedglobal SELSIZE % equals 1 if all packet sizes are selected select all, 0 if all packet sizes are unselectedglobal PLIKSKRYPT % Trace graph script file nameglobal PODZIAL % vector split size during file loading, during calculations of delays, processing times, etc.global RTT % equals 1 if Round Trip Time is calculated, otherwise 0OPLIK=0;FWDLENGTH=4;tryif length(varargin) == 1 & ischar(varargin{1})        OPLIK=1;        if isempty(findstr(varargin{1}, '.mat'))            TSTART=-1;            TEND=-1;        end        PLIKINT=0;elseif length(varargin) == 2    if strcmp(varargin{2}, '-ip')        if isempty(findstr(varargin{1}, '.mat'))            TSTART=-1;            TEND=-1;            konfig('trgraph.cfg');            podaj_ip(varargin{1}); % saves IPs to file        else            bledy(3);        end    else        bledy(6);    end    return;elseif length(varargin) == 3    if strcmp(varargin{2}, '-script')        PLIKSKRYPT=varargin{3};        OPLIK=1;        if isempty(findstr(varargin{1}, '.mat'))            TSTART=-1;            TEND=-1;        end        PLIKINT=0;    elseif isempty(findstr(varargin{1}, '.mat'))        OPLIK=1;        TSTART=str2num(varargin{2});        TEND=str2num(varargin{3});        if isempty(TSTART) | isempty(TEND)            bledy(5);            return;        elseif TSTART >= TEND            bledy(2);            return;        elseif TSTART<0            bledy(4);            return;        end        PLIKINT=1;    else        bledy(3);        return;    end    elseif length(varargin) == 4    if strcmp(varargin{2}, '-ip')        if isempty(findstr(varargin{1}, '.mat'))            TSTART=str2num(varargin{3});            TEND=str2num(varargin{4});            if isempty(TSTART) | isempty(TEND)                bledy(5);                return;            elseif TSTART >= TEND                bledy(2);                return;            elseif TSTART<0                bledy(4);                return;            end            konfig('trgraph.cfg');            podaj_ip(varargin{1}); % saves IPs to file            return;        else            bledy(3);            return;        end    end    elseif nargin == 0 | PLIKINT ~= 1    PLIKINT=0;endcatch    bledy(6);endif nargin == 0 | OPLIK == 1 % LAUNCH GUI        try        fid=fopen('license.txt','r');        l=fgets(fid);        while l~=-1            l=l(l~=10);            disp(l);            l=fgets(fid);                end        fclose(fid);    catch        fclose('all');        bledy(17);        return;    end        konfig('trgraph.cfg');    sfig = openfig('stats.fig','new');    shandles = guihandles(sfig);	guidata(sfig, shandles);    gfig = openfig('graphs.fig','new');    ghandles = guihandles(gfig);	guidata(gfig, ghandles);    fig = openfig(mfilename,'new');        % Use system color scheme for figure:    % Generate a structure of handles to pass to callbacks, and store it. 	handles = guihandles(fig);	guidata(fig, handles);    NUMDELINT=10;    set(ghandles.wykresy2d, 'Enable', 'off');    set(ghandles.wykresy3d, 'Enable', 'off');    set(ghandles.histograms, 'Enable', 'off');    set(ghandles.figure1, 'Color', get(0,'defaultUicontrolBackgroundColor'));    set(shandles.info, 'Enable', 'off');    set(handles.zapisz, 'Enable', 'off');    set(handles.numdelint, 'String', num2str(NUMDELINT));    set(handles.figure1, 'Color', get(0,'defaultUicontrolBackgroundColor'));    set(handles.figure1, 'Name', 'Trace graph 2.05');    %set(shandles.autozminf, 'Checked', 'on');    set(shandles.frame1, 'BackgroundColor', get(0,'defaultUicontrolBackgroundColor'));        set(shandles.figure1, 'Color', get(0,'defaultUicontrolBackgroundColor'));    set(shandles.frame2, 'BackgroundColor', get(0,'defaultUicontrolBackgroundColor'));    set(shandles.frame3, 'BackgroundColor', get(0,'defaultUicontrolBackgroundColor'));    set(shandles.frame4, 'BackgroundColor', get(0,'defaultUicontrolBackgroundColor'));    set(shandles.frame5, 'BackgroundColor', get(0,'defaultUicontrolBackgroundColor'));    set(shandles.frame6, 'BackgroundColor', get(0,'defaultUicontrolBackgroundColor'));    set(shandles.frame7, 'BackgroundColor', get(0,'defaultUicontrolBackgroundColor'));    set(shandles.frame8, 'BackgroundColor', get(0,'defaultUicontrolBackgroundColor'));    set(shandles.frame9, 'BackgroundColor', get(0,'defaultUicontrolBackgroundColor'));    set(shandles.frame10, 'BackgroundColor', get(0,'defaultUicontrolBackgroundColor'));    set(ghandles.kopiuj_do_clip, 'Accelerator', 'c');    %set(ghandles.kopiuj_do_clip, 'Enable', 'off');    CHECK=[0,0,0,0,0,0,0,0];    HISTINTERVALS=[];    WYKRESY=cell(1);    WYKRESTAG=cell(1);    WYKRESLAB=cell(1);    LICZBAWYK=0;    SELSIZE=0;    DELAY=0;    RTT=0;    CZY3D=0;    FID=-1;    KOLORY='bmcrgky';    IDCOUNT=0;    DC=0;    DCONLY=0;    TILNUM=6;    if nargout > 0		varargout{1} = fig;	end    if OPLIK == 1        otworz_plik(fig, varargin{1}, handles, varargin);    endelseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK	try		[varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard	catch        bledy(6);        disp(lasterr);	endend% --------------------------------------------------------------------function varargout = edit4_Callback(h, eventdata, handles, varargin)% edit current node numberglobal AKTWEZ LNOD CZY3D PRECx=str2num(get(h, 'String'));x=round(x);if x>-1 & x<LNOD    AKTWEZ=x;    check_info(handles, 0);    if CZY3D==0        odrysuj(h, handles, varargin);    endelse    set(h,'String',num2str(AKTWEZ,PREC));end% --------------------------------------------------------------------function varargout = startwez_Callback(h, eventdata, handles, varargin)% edit other node numberglobal STARTWEZ LNOD CHECK CZY3D PRECx=str2num(get(h, 'String'));x=round(x);if x>-1 & x<LNOD    STARTWEZ=x;    if CHECK(2)==1        check_info(handles, 0);    end    if CZY3D==0        odrysuj(h, handles, varargin);        endelse    set(h,'String',num2str(STARTWEZ,PREC));end% --------------------------------------------------------------------function varargout = pakcheck_Callback(h, eventdata, handles, varargin)% checks packet typeglobal CHECKif CHECK(1)==0    CHECK(1)=1;elseif CHECK(1)==1        CHECK(1)=0;endcheck_info(handles, 2);odrysuj(h, handles, varargin);% --------------------------------------------------------------------function varargout = startcheck_Callback(h, eventdata, handles, varargin)% checks other node

⌨️ 快捷键说明

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