time | Calls | line |
---|
| | 173 | function objUnitsModified = getObjWithUnits(h, unitsProp, units)
|
| | 174 |
|
| | 175 | % Returns an array of objects which have the unitsProp property
|
| | 176 | % value set to the specified units.
|
< 0.001 | 1 | 177 | saveProp = lower(unitsProp);
|
< 0.001 | 1 | 178 | for unitsIdx = 1:length(units)
|
0.006 | 5 | 179 | objWithUnits = findall(h, 'flat', unitsProp, units{unitsIdx}, '-property', 'Position');
|
| | 180 |
|
| | 181 | % Don't include the figure itself in this list
|
< 0.001 | 5 | 182 | handles = objWithUnits(~ishghandle(objWithUnits, 'figure'));
|
0.004 | 5 | 183 | objUnitsModified.(units{unitsIdx}).handles = num2cell(handles);
|
| | 184 |
|
| | 185 | % The get command returns a cell array when passed multiple
|
| | 186 | % handles. To keep the code simple downstream, wrap the single
|
| | 187 | % handle result in a cell array too.
|
0.001 | 5 | 188 | objUnitsModified.(units{unitsIdx}).positions = cellfun(@(ph)get(ph, 'Position'), ...
|
| 5 | 189 | objUnitsModified.(units{unitsIdx}).handles, 'UniformOutput', false);
|
| | 190 | % also store positionmode and unitsmode prop values
|
0.001 | 5 | 191 | objUnitsModified.(units{unitsIdx}).positionmode = ...
|
| 5 | 192 | cellfun(@(ph) getPropMode(ph, 'Position'), objUnitsModified.(units{unitsIdx}).handles, 'UniformOutput', false);
|
0.001 | 5 | 193 | objUnitsModified.(units{unitsIdx}).([saveProp 'mode']) = ...
|
| 5 | 194 | cellfun(@(ph) getPropMode(ph, unitsProp), objUnitsModified.(units{unitsIdx}).handles, 'UniformOutput', false);
|
< 0.001 | 5 | 195 | end
|
| | 196 |
|
< 0.001 | 1 | 197 | end
|
Other subfunctions in this file are not included in this listing.