Variable Explorer does not update values when changing properties (2025a/b)
38 次查看(过去 30 天)
显示 更早的评论
I have a problem with the current version of variable explorer:
Whenever I use debug mode to assess the behavior of the object constructor, I cannot observe the object in the variable viewer simultaneously because the properties are not updated in there when changed/assigned by e.g. stepping through the constructor steps or using the console.
The properties themselves are updated (as can be checked through variable explorer by opening the individual properties themselves), but that change is now shown in the "obj" variable in variable viewer. However, closing and reopening "obj" in the variable viewer does update the properties in variable viewer. This is of course all in the function workspace of the constructor, if I understand this correctly.
UPDATE: I just noticed this behavior does not only refer to constructor functions, but class functions/methods in general. I've updated the examples accordingly. The behavior can be observed in both calls independently in debug mode.
As far as I remember, this behavior was not the same in previous version of MATLAB. Is there any setting or flag that I have to update to be able to debug the contructor behavior step-by-step without having to reopen the variables over and over again?
I've written a simple test class and constructor to reproduce this behavior down below. The behavior is also completely disregarding of property type.
Test Class:
classdef test_class
%TEST_CLASS Summary of this class goes here
% Detailed explanation goes here
properties
Property1 = 5
Property2 = 'test'
Property3 = [1 2; 3 4]
Property4 = {[1 2 3], [1 2 3 4 5 6]}
end
methods
function obj = test_class(inputArg1,inputArg2)
%TEST_CLASS Construct an instance of this class
% Detailed explanation goes here
obj.Property1 = inputArg1 + inputArg2;
obj.Property2 = 'var test';
obj.Property3(2) = 5;
obj.Property4{1} = [1 2 3 4];
obj.Property4{2}(3) = 8;
end
function method1(obj,inputArg)
%METHOD1 Summary of this method goes here
% Detailed explanation goes here
obj.Property1 = inputArg;
obj.Property3(3) = inputArg;
end
end
end
Simple Call:
test_var = test_class(4, 5);
test_class.method1(10);
2 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Results, Reporting, and Test File Management 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!