[Scilab-users] Padarray Matlab equivalent in Scilab

Samuel Gougeon sgougeon at free.fr
Wed Feb 10 20:00:43 CET 2016


Le 10/02/2016 16:43, sgougeon at free.fr a écrit :
>> Thanks for the ideas, it kind of solves the need, but pads to left and bottom only:
> tmp = [data ; repmat(data($, :), addedRows, 1)];
> paddedMat = [tmp  repmat(tmp(:, $) , 1, addedCols)]
>
> padds on the bottom and RIGHT.
> To pad on the left and top, just tune the concatenation:
>
> tmp = [repmat(data($, :), addedRows, 1) ; data];
> paddedMat = [repmat(tmp(:, $) , 1, addedCols) tmp]
Rather

tmp = [repmat(data(1, : ), addedRows, 1) ; data];
paddedMat = [repmat(tmp(:,1) , 1, addedCols) tmp]

SG




More information about the users mailing list