How to freeze 'get method' while debugging program
조회 수: 1 (최근 30일)
이전 댓글 표시
For example,Add a program breakpoint on the 21th line“notify(obj,'UpdateGraph');” 24th line “[x,y] = MFunEval.grid(obj.Lm);”
The program steps to the 21th line ,you check “obj.hFun” .
At this point, the program will start to execute the “get method” in 24th line, but this is not what I want, and it will cause many accidents. matlab will open many build in function files. (start to execute the “get method” ------This makes sense, but I don't want the ‘get method’ to be triggered repeatedly when the debug view variable)
I want the program to execute sequentially.
How to not trigger the get method when viewing the variable without changing the program code. Are there any debugging tips here?
classdef MFunEval<handle %函数计算类
properties
hFun %函数句柄
end
properties (SetObservable = true)
Lm = []; %区间
end
properties (Dependent = true)
Data %保存网格化数据
end
events
UpdateGraph %更新图形
end
methods
function obj = MFunEval(fcn_handle,limits) %构造函数
obj.hFun = fcn_handle;
obj.Lm = limits;
end
function fofxy = set.hFun(obj,func)
obj.hFun = func;
notify(obj,'UpdateGraph'); %广播事件
end
function data = get.Data(obj) %获取网格化数据
[x,y] = MFunEval.grid(obj.Lm);
matrix = obj.hFun(x,y);
data.X = x;
data.Y = y;
data.Matrix = matrix;
end
end
methods (Static)
function [x,y] = grid(lim) %网格化
inc = (lim(2)-lim(1))/20;
[x,y] = meshgrid(lim(1):inc:lim(2));
end
end
end
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Software Development Tools에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!