[Scilab-users] Padarray Matlab equivalent in Scilab

Lester Anderson arctica1963 at gmail.com
Wed Feb 10 14:10:37 CET 2016


Thanks for the ideas, it kind of solves the need, but pads to left and
bottom only:
adding 2 cols/rows say to [1 2 3; 4 5 6; 7 8 9]

1 2 3 3 3
4 5 6 6 6
7 8 9 9 9
7 8 9 9 9
7 8 8 9 9

Is it possible to replicate on the top and right edges? (1 2 3) and (1 4 7)

Also looked at resize_matrix(data, nr, nc) and that too only worked on
right and bottom values, padding with 0 by default.





On 10 February 2016 at 10:16, Samuel Gougeon <sgougeon at free.fr> wrote:
> 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
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>



More information about the users mailing list