On 12/15/2014 07:04 PM, seltek wrote:
I wish to create a matrix that would use the values of initial matrix (for
example a 3x3 ones matrix) to set the values in this new matrix (a 6x6
matrix (or 2*Nx2*N))to be equal to the values of the initial matrix on every
alternate column and row
Octave is very good at operations on entire matrices. You can of
course write loops that go elementbyelement but it's faster and
easier to write 'vectorized' codeyou just have to get used to it,
and it's definitely worth the effort.
Octave has a range operator that can express your skipped index:
1:2:N, and so your assignment can be written as
new=initial(1:2:N,1:2:N)
