-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Null assignment (
x(...)=[]
) with a single index is now possible w…
…ith function `(` * Added functions to simplify indexing rows of columns of 2D arrays: `Y)`, `Z)` for reference indexing; `Y(`, `Z(` for assignment indexing. The latter allow null assignment with a single index. * Added function `conv2(...,'valid')` (`Z+`) * `cumsum`, `cumprod` now allow char input * Renamed functions "linearize array", "comma-separated list", `gallery` * Octave compatibility for `diff` and `mod` with char input * Octave compatibility with `repelem` (thanks, @beaker!) * Fixed incorrect <strong>...</strong> tags in Octave
- Loading branch information
Showing
10 changed files
with
133 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
function y = diff(varargin) | ||
% Allows first input to be char | ||
if ischar(varargin{1}) | ||
varargin{1} = double(varargin{1}); | ||
end | ||
y = builtin('diff', varargin{:}); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function y = mod(varargin) | ||
% Allows inputs to be char | ||
if ischar(varargin{1}) | ||
varargin{1} = double(varargin{1}); | ||
end | ||
if ischar(varargin{2}) | ||
varargin{2} = double(varargin{2}); | ||
end | ||
y = builtin('mod', varargin{:}); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function y = repelem(varargin) | ||
% Implements Matlab's `repelem` in Octave | ||
if nargin==2 && isvector(varargin{1}) && isvector(varargin{2}) && numel(varargin{2})>1 | ||
ind = repelems(1:numel(varargin{1}), [1:numel(varargin{1}); varargin{2}(:).']); | ||
y = varargin{1}(ind); | ||
elseif nargin==2 && isvector(varargin{1}) && isvector(varargin{2}) && numel(varargin{2})==1 | ||
ind = repelems(1:numel(varargin{1}), [1:numel(varargin{1}); repmat(varargin{2},1,numel(varargin{1}))]); | ||
y = varargin{1}(ind); | ||
elseif nargin>2 | ||
ind = cell(1,nargin-1); | ||
for k = 2:nargin | ||
r = varargin{k}; | ||
ind{k-1} = ceil(1/r:1/r:size(varargin{1},k-1)); | ||
end | ||
y = varargin{1}(ind{:}); | ||
else | ||
error('Inputs not supported') | ||
end | ||
end |
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters