How to rewrite the nested for loop to modify matrix elments when matrix size is huge
2 views (last 30 days)
Hi I have the below matrix MN which is already pre-defined and I want to modify its elements without using for loop. Here I just set N=2 but in reality N is around 500. f(m) and g(n) are just user-defined functions. Is there a better way to rewrite it avoiding nested for loops?
m_offset = (m-1)*N+n;
n_offset = (m-1)*N+n;
MN(m_offset,n_offset) = f(m);
MN(m_offset,n_offset+NN) = g(n);