[Scilab-users] range of colon

Federico Miyara fmiyara at fceia.unr.edu.ar
Tue Jan 14 22:40:07 CET 2020


Dear all,

I need to zero-pad the columns of an N-D array x to a length N. I've 
found the following solution:

siz = size(x);
a = repmat(0,[N, siz(2:$)]);     // Create array of 0's whose columns 
have length N
                                  // and the remaining dimensions are 
the same as in x
a(1:siz(1), :) = x;              // Replace non-padding 0's by x

This seems to work. However, I'm concerned about the use of the last : 
as a replacemant for all the remaining dimensions, since I couldn't find 
it documented. Is it an intended behviour?

Regards,

Federico Miyara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20200114/379bf21a/attachment.htm>


More information about the users mailing list