I have an array A=[-2 -1 0 1 3 5] which has 6 values and maximum value is 5 and minimum value is -2. I wanna generate a 6 by 10(=5+abs(-2)+3) matrix B. B=[1 1 1 0 0 0 0 0 0 0; 0 1 1 1 0 0 0 0 0 0; 0 0 1 1 1 0 0 0 0 0; 0 0 0 1 1 1 0 0 0 0; 0 0 0 0 0 1 1 1 0 0; 0 0 0 0 0 0 0 1 1 1 ]. We can assume the virtual number of column in matrix B is [-3 -2 -1 0 1 2 3 4 5 6]. Each row data in matrix B is from each number in array A. For example, -2 in array A means we should set (-2+1=-1), (-2) and (-2-1=-3) for 1 on the first row in matrix B, so the value should be [1 1 1 0 0 0 0 0 0 0]. -1 in array A means we should set (-1+1=0), (-1) and (-1-1=-2) for 1 on the second row in matrix B, so the value should be [0 1 1 1 0 0 0 0 0 0]. In this example, the size of array A is 1 by 6, Actuallly, it could be 1 by n. Please tell the faster way to generate matrix B. Thanks