time | Calls | line |
|---|
| | 1535 | function out = getWhosInformation(in)
|
| | 1536 |
|
< 0.001 | 3 | 1537 | if numel(in) == 0
|
< 0.001 | 3 | 1538 | out = com.mathworks.mlwidgets.workspace.WhosInformation.getInstance;
|
| | 1539 | else
|
| | 1540 | % Prune the dataset to only include the deepest nesting level - this
|
| | 1541 | % is relevant for nested functions when debugging. The desired behavior
|
| | 1542 | % is to only show the variables in the deepest workspace.
|
| | 1543 | nesting = [in.nesting];
|
| | 1544 | level = [nesting.level];
|
| | 1545 | prunedWhosInformation = in(level == max(level));
|
| | 1546 |
|
| | 1547 | % Perform a case insensitive sort since "whos" returns the variables
|
| | 1548 | % sorted in case sensitive order. Since this case sensitive order
|
| | 1549 | % puts capital letters ahead of lower case, reverse it first, so that
|
| | 1550 | % the sort resolves matching lower case names with capital letters
|
| | 1551 | % after lower case. This ensures that the variables are sorted with an
|
| | 1552 | % order that matches the details pane of CSH (944091)
|
| | 1553 | names = {prunedWhosInformation.name};
|
| | 1554 | [~,I] = sort(lower(names(end:-1:1)));
|
| | 1555 | I = length(names)-I+1;
|
| | 1556 | sortedWhosInformation = prunedWhosInformation(I);
|
| | 1557 |
|
| | 1558 | siz = {sortedWhosInformation.size}';
|
| | 1559 | names = {sortedWhosInformation.name};
|
| | 1560 | inbytes = [sortedWhosInformation.bytes];
|
| | 1561 | inclass = {sortedWhosInformation.class};
|
| | 1562 | incomplex = [sortedWhosInformation.complex];
|
| | 1563 | insparse = [sortedWhosInformation.sparse];
|
| | 1564 | inglobal = [sortedWhosInformation.global];
|
| | 1565 |
|
| | 1566 | try
|
| | 1567 | out = com.mathworks.mlwidgets.workspace.WhosInformation(names, ...
|
| | 1568 | siz, inbytes, inclass, incomplex, insparse, inglobal);
|
| | 1569 | catch
|
| | 1570 | % This may have failed because the number of dimensions in one of
|
| | 1571 | % the variables is so large that the java array of dimensions fails
|
| | 1572 | % to be created. Retry using a size of -1x-1, and set the
|
| | 1573 | % sizeLengths to be used instead. Note - using a try/catch
|
| | 1574 | % instead of checking beforhand so there's no change in performance
|
| | 1575 | % under normal circumstances.
|
| | 1576 | sizeLengths = cellfun(@length, siz);
|
| | 1577 | siz(sizeLengths > 100000) = {[-1, -1]};
|
| | 1578 | out = com.mathworks.mlwidgets.workspace.WhosInformation(names, ...
|
| | 1579 | siz, inbytes, inclass, incomplex, insparse, inglobal, sizeLengths);
|
| | 1580 | end
|
< 0.001 | 3 | 1581 | end
|
Other subfunctions in this file are not included in this listing.