Hi everyone,
I am new to Matlab and I am trying to gain some first experiences using the book 'Learning MATLAB' by T.Discroll. Currently I am struggling with the following problem:
Create a 10 x 10 matrix (A) and replace entries in the following manner:
Set the entry a(i,j) of the matrix A to 1 if i-j is prime, otherwise set the value to zero.
Attempts I had taken were either including the 'ind2sub' command or an if-loop, but that didn't help.
To generalize the question: 'How can i change values of a matrix using subscript indexing, when the subscripts meet a certain condition'.
So far extended search in books or google didn't help either.
Thanks in advance!
Best Answer