[Scilab-users] Padarray Matlab equivalent in Scilab
Samuel Gougeon
sgougeon at free.fr
Wed Feb 10 11:16:54 CET 2016
Le 10/02/2016 11:02, Samuel Gougeon a écrit :
> There is no real Scilab equivalent. Scilab's repmat() could be extended.
> For the time being, to process, you may use the 2 following lines:
>
> tmp = [data ; data($, :) .*. ones(addedRows, 1)];
> paddedMat = [tmp tmp(:, $) .*. ones(1,addedCols)];
This workaround works with numerical data (reals, complexes, encoded
integers, polynomials).
For boolean data, paddedMat becomes {0|1}. To recover a boolean padded
matrix:
paddedMat = (paddedMat==1)
For a matrix of text, repmat() must be used instead of the kronecker
product.
The following will work whatever is the type of unmixed data, boolean
and text included:
tmp = [data ; repmat(data($, :), addedRows, 1)];
paddedMat = [tmp repmat(tmp(:, $) , 1, addedCols)]
SG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20160210/521fa4d2/attachment.htm>
More information about the users
mailing list