Hello everyone. I have a class, 'objContainer', that holds an object array of 'obj' handle objects. Each 'obj' holds four numbers. I want to access and edit each 'obj' individually and their numbers quickly. The code to set and retrieve the objects is as follows, but it's very slow even for sizes of 4 x 100:
function objContainer = setObj(objContainer, indices, obj) idx = num2cell(indices); objContainer.objArray(idx{:}) = obj;end function obj = getObj(objContainer, indices) idx = num2cell(indices); obj = objContainer.objArray(idx{:});end
Looking at the profiler, the slowdown is at the lines:
objContainer.objArray(idx{:}) = obj;
and
obj = objContainer.objArray(idx{:});
Does anyone have a faster way of accessing these types of arrays?
Best Answer