Skip to content

Commit

Permalink
Change in Zt
Browse files Browse the repository at this point in the history
`Zt`: if the first input is char it is linearized into a row vector.
  • Loading branch information
lmendo committed Sep 29, 2018
1 parent b350fc7 commit 30c9036
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
Binary file modified funDef.mat
Binary file not shown.
3 changes: 2 additions & 1 deletion funDef.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1705,10 +1705,11 @@ Zs 1 4 1 2 1 1 1 true true true true if ischar(in{1}), in{1} = double(in{1}); e
t 0 inf 1 0 0 0 false true false true out = in; duplicate elements duplicate elements in stack. The duplicated elements are those specified as inputs
Xt
Yt
Zt 3 3 3 1 1 1 true true true true if ischar(in{1}) || iscell(in{1}) replace substring with another (i) If first input is char or a cell array: \matlab+strrep+. Numerical second and third inputs are converted to char. (ii) The first input can be a numerical or logical array (not a cell array of numeric or logical arrays). In this case the other inputs can be char, numeric or logical (not cell); each input array is linearized; result is a row vector; and result has the type of the third input, even if no substitutions have been actually done
Zt 3 3 3 1 1 1 true true true true if ischar(in{1}) || iscell(in{1}) replace substring with another (i) If first input is char or a cell array: \matlab+strrep+. Numerical second and third inputs are converted to char. If the first input is char it is linearized into a row vector. (ii) The first input can be a numerical or logical array (not a cell array of numeric or logical arrays). In this case the other inputs can be char, numeric or logical (not cell); each input array is linearized; result is a row vector; and result has the type of the third input, even if no substitutions have been actually done
if isnumeric(in{2}), in{2} = char(in{2}); end
if isnumeric(in{3}), in{3} = char(in{3}); end
% The above two lines are needed {in Matlab and in Octave} if in{1} is cell, and are needed {only in Octave} if in{1} is char
in{1} = in{1}(:).';
out{1} = strrep(in{:});
else
t = in{1}(:).'; p = in{2}(:).'; r = in{3}(:).'; m = numel(p); n = numel(r);
Expand Down
Binary file modified help.mat
Binary file not shown.
Binary file modified spec/MATL_spec.pdf
Binary file not shown.
5 changes: 3 additions & 2 deletions spec/funDefTable/funDefTable.tex
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,17 @@
\matl{Ys} & 1--4 (1 / 2) & 1 & \matlab+cumsum+. Allows first input to be char. Optional third and fourth numerical scalar inputs are interpreted as minimum and maximum values, which are applied after the sum at each position. These can be substituted by a 2-element numerical array as second or third input \\
\matl{Zs} & 1--4 (1 / 2) & 1 & (i) \matlab+std+. (ii) With $2$ inputs \matlab+x+, \matlab+k+ and \matlab+k+ equal to $2$ or $3$, gives \matlab+cov(x, k-2)+. (iii) With $2$ inputs \matlab+x+, \matlab+k+ and \matlab+k+ equal to $4$ or $5$, gives \matlab+skewness(x(:), k-4)+. (iv) With $2$ inputs \matlab+x+, \matlab+k+ and \matlab+k+ equal to $6$ or $7$, gives \matlab+kurtosis(x(:), k-6)+ \\
\matl{t} & 0-- (1) & 0 & duplicate elements in stack. The duplicated elements are those specified as inputs \\
\matl{Zt} & 3 & 1 & (i) If first input is char or a cell array: \matlab+strrep+. Numerical second and third inputs are converted to char. (ii) The first input can be a numerical or logical array (not a cell array of numeric or logical arrays). In this case the other inputs can be char, numeric or logical (not cell); each input array is linearized; result is a row vector; and result has the type of the third input, even if no substitutions have been actually done \\
\matl{Zt} & 3 & 1 & (i) If first input is char or a cell array: \matlab+strrep+. Numerical second and third inputs are converted to char. If the first input is char it is linearized into a row vector. (ii) The first input can be a numerical or logical array (not a cell array of numeric or logical arrays). In this case the other inputs can be char, numeric or logical (not cell); each input array is linearized; result is a row vector; and result has the type of the third input, even if no substitutions have been actually done \\
\matl{u} & 1--4 (1) & 1--4 (1) & \matlab+unique+, with \matlab+'stable'+ option by default. It includes a fourth output with the count for each unique element. It also allows cell array input with numeric content, or mixed char/numeric content. In this case it only works with a single output, either in sorted or stable mode. This function allows flag strings in second and subsequent inputs to be replaced by numbers, as follows: 1: \matlab+'stable'+, 2: \matlab+'sorted'+, 3: \matlab+'last'+, 4: \matlab+'first'+, 5: \matlab+'rows'+. \sa \matl{Xu} \\
\matl{Xu} & 1--3 (1) & 1--4 (1) & \matlab+unique(..., 'rows', ...)+, with \matlab+'stable'+ option by default. It includes a fourth output with the count for each unique row. This function allows flag strings in second and subsequent inputs to be replaced by numbers, as follows: 1: \matlab+'stable'+, 2: \matlab+'sorted'+, 3: \matlab+'last'+, 4: \matlab+'first'+. \sa \matl{u} \\
\matl{Zu} & 2 & 1 & \matlab+strjust+. Strings in second input can be replaced by numbers, as follows: 1: \matlab+'right'+, 2: \matlab+'left'+, 3: \matlab+'center'+ \\
\matl{v} & 0-- ($^\ddagger$ / 2) & 1 & \matlab+vertcat+. If inputs are matrices with non-matching sizes they are linearized \\
\matl{Yv} & 1--2 (1) & 1--3 (1 / 2nd) & (i) If input is numeric: with $1$ or $2$ outputs: \matlab+eig+. With $3$ outputs: \matlab+svd+. If output specification is \matl{TFT} (keep second output only), \matlab+svd+ is called with a single output, which gives a vector with the singular values. (ii) If input is a string or cell array of strings: \matlab+strtrim+. For string or char array input, char $0$ also counts as whitespace \\
\matl{Zv} & 1--2 (1 / 2) & 1 & (i) For one numeric input \matlab+n+: symmetric range. For nonnegative \matlab+n+ it rounds down and then gives \matlab+[1:n n-1:-1:1]+; for negative \matlab+n+ it removes sign, rounds down and gives \matlab+[n:-1:1 2:n]+. (ii) For two inputs: applies symmetric range indexing to the first input along each dimension specified by the (linearized) second input. The indexing along a given dimension doesn't repeat the last entry if the number specifying the dimension is positive, and repeats it if negative. (iii) For one string or cell array input: \matlab+deblank+ \\
\matl{w} & 0-- (2) & 0 & swap elements in stack \\
\matl{x} & 0-- (1) & 0 & delete from stack \\
\matl{x} & 0-- (1) & 0 & delete elements from stack. The deleted elements are those specified as inputs \\
\matl{Xx} & 0--1 (0 / 1) & 0 & \matlab+clc+. With $1$ input \matlab+x+: \matlab+pause(x/10)+ and then \matlab+clc+. Inputs \matl{F} and \matl{T} are interpreted as \matl{2.5} and \matl{10} respectively \\
\matl{Zx} & 0 & 0 & resets stack, input/output specifications and clipboards to their initial values \\
\matl{y} & 0-- (2 / 3) & 0 & duplicate one element in stack. The duplicated element is the lowest among those specified as inputs \\
\matl{Xy} & 1--4 (1) & 1 & \matlab+eye+ (matrix with ones on diagonal and zeros elsewhere) \\
\matl{Yy} & 2 & 1 & \matlab+hypot+, element-wise with singleton expansion \\
Expand Down

0 comments on commit 30c9036

Please sign in to comment.