time | calls | line |
---|
| | 1205 | function out = getWhosInformation(in)
|
| | 1206 |
|
| 2 | 1207 | if numel(in) == 0
|
| 2 | 1208 | out = com.mathworks.mlwidgets.workspace.WhosInformation.getInstance;
|
| | 1209 | else
|
| | 1210 | % Prune the dataset to only include the deepest nesting level - this
|
| | 1211 | % is relevant for nested functions when debugging. The desired behavior
|
| | 1212 | % is to only show the variables in the deepest workspace.
|
| | 1213 | nesting = [in.nesting];
|
| | 1214 | level = [nesting.level];
|
| | 1215 | prunedWhosInformation = in(level == max(level));
|
| | 1216 |
|
| | 1217 | % Perform a case insensitive sort since "whos" returns the variables
|
| | 1218 | % sorted in case sensitive order. Since this case sensitive order
|
| | 1219 | % puts capital letters ahead of lower case, reverse it first, so that
|
| | 1220 | % the sort resolves matching lower case names with capital letters
|
| | 1221 | % after lower case. This ensures that the variables are sorted with an
|
| | 1222 | % order that matches the details pane of CSH (944091)
|
| | 1223 | names = {prunedWhosInformation.name};
|
| | 1224 | [~,I] = sort(lower(names(end:-1:1)));
|
| | 1225 | I = length(names)-I+1;
|
| | 1226 | sortedWhosInformation = prunedWhosInformation(I);
|
| | 1227 |
|
| | 1228 | siz = {sortedWhosInformation.size}';
|
| | 1229 | names = {sortedWhosInformation.name};
|
| | 1230 | inbytes = [sortedWhosInformation.bytes];
|
| | 1231 | inclass = {sortedWhosInformation.class};
|
| | 1232 | incomplex = [sortedWhosInformation.complex];
|
| | 1233 | insparse = [sortedWhosInformation.sparse];
|
| | 1234 | inglobal = [sortedWhosInformation.global];
|
| | 1235 |
|
| | 1236 | out = com.mathworks.mlwidgets.workspace.WhosInformation(names, ...
|
| | 1237 | siz, inbytes, inclass, incomplex, insparse, inglobal);
|
| | 1238 | end
|
Other subfunctions in this file are not included in this listing.