Why is assignment to a cell array of objects class property slow in MATLAB 7.6 (R2008a)?
Show older comments
I have a simple class "baseClass" and a class "cellClass" with a property that is a cell array of objects of "baseClass"
classdef cellClass < handle
properties
basecell = cell(1,1000);
end
methods
function obj = createCell(obj)
for i = 1:1000
newbase = baseClass(4,5,6);
obj.basecell{i} = newbase;
end
end
end
end
From profiling my code, I find that the assignment of objects of "baseClass" to the elements of the cell array is prohibitively slow, (taking around 20 seconds for 1000 assignments)
Accepted Answer
More Answers (0)
Categories
Find more on Construct and Work with Object Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!