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 <[email protected]> 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 > [email protected] > http://lists.scilab.org/mailman/listinfo/users > _______________________________________________ users mailing list [email protected] http://lists.scilab.org/mailman/listinfo/users
