time | Calls | line |
---|
| | 1 | function itemsToSnap = compareFigures(oldItems, newItems)
|
| | 2 | %COMPAREFIGURES Compare figures to baseline.
|
| | 3 | % COMPAREFIGURES lists the figures or systems that have changed.
|
| | 4 |
|
| | 5 | % Copyright 1984-2017 The MathWorks, Inc.
|
| | 6 |
|
| | 7 | % The publishing tools use this
|
| | 8 |
|
| | 9 | % OLDITEMS and NEWITEMS are structures returned by CAPTUREFIGURES or
|
| | 10 | % SNAPNOW>CAPTURESYSTEMS, which are assumed to have the following
|
| | 11 | % structure:
|
| | 12 | %
|
| | 13 | % x.id is a row vector of numeric handles, or names in a cell array
|
| | 14 | % x.data(k) is data that describes x.id(k).
|
| | 15 | %
|
| | 16 | % If corresponding data is equal between new and old items, the figure or
|
| | 17 | % system is assumed to be unchanged.
|
| | 18 |
|
| | 19 | % Set this global variable and PUBLISH displays debugging info.
|
< 0.001 | 5 | 20 | global PUBLISHING_DEBUGGING_FLAG
|
< 0.001 | 5 | 21 | if isempty(PUBLISHING_DEBUGGING_FLAG)
|
< 0.001 | 5 | 22 | debug = false;
|
| | 23 | else
|
| | 24 | debug = PUBLISHING_DEBUGGING_FLAG;
|
< 0.001 | 5 | 25 | end
|
| | 26 |
|
| | 27 | % For compatibility with previous versions
|
< 0.001 | 5 | 28 | if nargin == 1
|
| | 29 | newItems = internal.matlab.publish.captureFigures;
|
| | 30 | end
|
| | 31 |
|
| | 32 | % Assume (for now), that old figures have no changes.
|
< 0.001 | 5 | 33 | oldId = oldItems.id;
|
< 0.001 | 5 | 34 | newId = newItems.id;
|
0.011 | 5 | 35 | [unchanged, iNewToOld] = ismember(newId, oldId);
|
| | 36 |
|
< 0.001 | 5 | 37 | if debug
|
| | 38 | debugDispNew(newItems, unchanged)
|
| | 39 | end
|
| | 40 |
|
| | 41 | % Check old figures in detail.
|
< 0.001 | 5 | 42 | for iNew = find(unchanged)
|
| | 43 | iOld = iNewToOld(iNew);
|
| | 44 |
|
| | 45 | unchanged(iNew) = isequaln( ...
|
| | 46 | oldItems.data(iOld), newItems.data(iNew));
|
| | 47 |
|
| | 48 | if debug
|
| | 49 | debugDispChanges(oldItems, iOld, newItems, iNew, unchanged)
|
| | 50 | end
|
| | 51 | end
|
| | 52 |
|
| | 53 | % Form list of those that have changed.
|
< 0.001 | 5 | 54 | itemsToSnap = newItems.id(~unchanged);
|
| | 55 |
|
| | 56 | % If it is empty, this file probably created it. Clean it up.
|
< 0.001 | 5 | 57 | if isempty(PUBLISHING_DEBUGGING_FLAG)
|
< 0.001 | 5 | 58 | clear global PUBLISHING_DEBUGGING_FLAG
|
< 0.001 | 5 | 59 | end
|
| | 60 |
|
< 0.001 | 5 | 61 | end
|
Other subfunctions in this file are not included in this listing.