Skip to content

Commit

Permalink
Miscellaneous tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
djoshea committed Sep 27, 2022
1 parent cf2ea2b commit 4f1ebe3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plotting/pmatbal.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
if isnan(L)
L = gather(max(abs(m(:))));
end
caxis([-L L]);
caxis([-L-eps L+eps]);
2 changes: 1 addition & 1 deletion plotting/scattercol.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

if size(X, 2) == 2
h = scatter(X(:, 1), X(:, 2), varargin{:});
elseif size(X, 3) == 3
elseif size(X, 2) == 3
h = scatter3(X(:, 1), X(:, 2), X(:, 3), varargin{:});
else
error('X has too many columns');
Expand Down
9 changes: 7 additions & 2 deletions string/upperFirst.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@

fn = @(str) strcat(upper(str(1)), str(2:end));

if iscellstr(str)
if isstring(str)
capStr = strings(size(str));
for iS = 1:numel(str)
capStr(iS) = upper(extractBefore(str(iS), 2)) + extractAfter(str(iS), 1);
end
elseif iscellstr(str)
capStr = cellfun(fn, str, 'UniformOutput', false);
elseif ischar(str)
capStr = fn(str);
else
error('firstUpper accepts char or cellstr argument');
error('upperFirst accepts char or cellstr argument');
end

end

0 comments on commit 4f1ebe3

Please sign in to comment.