tracer

버전 1.0.0 (1.56 KB) 작성자: Stefan Schuberth
traces programm flow
다운로드 수: 0
업데이트 날짜: 2022/12/19

라이선스 보기

the handle class tracer impements the possibility to monitor the programm flow inside a class.
Just inherit the class to your testclass like:
classdef testclass < tracer
The methods:
AddTrace adds the actual stack of the method call to the property trace.
IsInternalCall checks if the method call is from within the class or from the command line / other class
ListTrace show the trace in detail what methods have been called.
This can be very usefull if you just want the get/set method to do special stuff when it is called from the command line, or when it is called internally.
EXAMPLE:
I used it to control a heating element.
a=heater; a.temperature=40; communicates with RS232 and sets a new temperature
during heating up obj.temperature=actual_temperature; just sets a new temperature to the properties inside the class
classdef testclass < handle & tracer
properties
g=[1 2 3 4 5];
end
methods
function set.g(obj,x)
%obj.AddTrace;
disp('set g');
obj.g=x;
disp(sprintf('internal call: %i',obj.IsInternalCall));
end
function b=get.g(obj)
%obj.AddTrace;
disp('get g');
b=obj.g;
disp(sprintf('internal call: %i',obj.IsInternalCall));
end
function aa(obj)
obj.ListTrace;
end
function bb(obj)
%obj.AddTrace;
obj.g=3;
end
function c=cc(obj)
%obj.AddTrace;
c=obj.g;
end
function ListTrace(obj)
disp(obj.trace);
disp(sprintf('internal call: %i',obj.IsInternalCall));
end
end
end

인용 양식

Stefan Schuberth (2026). tracer (https://kr.mathworks.com/matlabcentral/fileexchange/122292-tracer), MATLAB Central File Exchange. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2022b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0