Skip to content

Commit

Permalink
Alternative input/output specification for u
Browse files Browse the repository at this point in the history
  • Loading branch information
lmendo committed Jan 9, 2022
1 parent 65f0a1e commit ee8bd43
Show file tree
Hide file tree
Showing 11 changed files with 8 additions and 60 deletions.
Binary file modified funDef.mat
Binary file not shown.
2 changes: 1 addition & 1 deletion funDef.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1849,7 +1849,7 @@ Zt 3 3 3 1 1 1 true true true true if ischar(in{1}) || iscell(in{1}) replace s
if islogical(in{3}), y = logical(y); end
out{1} = y; clear t p r m n mem
end
u 1 4 1 1 4 1 true true true true str = {'stable' 'sorted' 'last' 'first' 'rows'}; unique \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+
u 1 4 1 1 4 1 [true false false true] true true true true str = {'stable' 'sorted' 'last' 'first' 'rows'}; unique \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+
for k = 2:numel(in), if isnumeric(in{k}), in(k) = str(in{k}); end; end; clear str
if numel(in)==1 || (numel(in)==2 && strcmp(in{2}, 'rows')), in{end+1} = 'stable'; end
if iscell(in{1}) && ~all(cellfun(@ischar, in{1}))
Expand Down
4 changes: 3 additions & 1 deletion genHelp.m
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,11 @@
% necessary (that depends on the function. For `find` it would be necessary, because its first output changes
% depending on whether there's a second output or not). So I don't specify
case {'[false true false]' '[false,true,false]' '[false, true, false]'}
altOutStr = '2nd'; % It should be specified "2nd of 3"
altOutStr = '2nd'; % It should be specified '2nd of 3'
case {'[false false true]' '[false,false,true]' '[false, false, true]'}
altOutStr = '3rd';
case {'[true false false true]' '[true,false,false,true]' '[true, false, false, true]'}
altOutStr = '1st and 4th';
case {'ndims(in{1})'}
altOutStr = 'number of dimensions of first input';
otherwise
Expand Down
Binary file modified help.mat
Binary file not shown.
2 changes: 1 addition & 1 deletion spec/MATL_spec.aux
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
\gdef \LT@i {\LT@entry
{1}{23.31676pt}\LT@entry
{6}{58.27696pt}\LT@entry
{4}{68.87401pt}\LT@entry
{13}{100.5081pt}\LT@entry
{1}{273.29929pt}}
\gdef \LT@ii {\LT@entry
{1}{23.69952pt}\LT@entry
Expand Down
Binary file modified spec/MATL_spec.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion spec/funDefTable/funDefTable.tex
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
\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. \sa \matl{y} \\
\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{u} & 1--4 (1) & 1--4 (1 / 1st and 4th) & \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 \\
Expand Down
56 changes: 0 additions & 56 deletions spec/latex_tools/MATL_spec.aux

This file was deleted.

Empty file removed spec/latex_tools/MATL_spec.out
Empty file.
Binary file removed spec/latex_tools/MATL_spec.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions spec/latex_tools/genFunDefTableLatex.m
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@
altOut = '2nd';
case {'[false false true]' '[false,false,true]' '[false, false, true]'}
altOut = '3rd';
case {'[true false false true]' '[true,false,false,true]' '[true, false, false, true]'}
altOut = '1st and 4th';
case {'ndims(in{1})'}
altOut = '$^\times$';
otherwise
Expand Down

0 comments on commit ee8bd43

Please sign in to comment.