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!