Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • $\begingroup$ Your answer is very good, with one slight change. When you move the 2nd row to 4th row, the order of the rows should remain unchanged. It means that when you move the 2nd row, the 3rd and 4th rows should just be moved up without changing the order. Of course the same applies to the column movements. This is important for my purpose and that is why I gave a name for rows and columns. Thank you very much for your very quick answer. $\endgroup$ Commented Mar 20, 2019 at 14:03
  • $\begingroup$ @TugrulTemel I see. Is this better now? I am not sure if the case $i>j$ is handled as you expect. $\endgroup$ Commented Mar 20, 2019 at 14:16
  • $\begingroup$ Excellent...that is what I aim to achieve. Really, thank you so much for your prompt answer. regards, Tugrul $\endgroup$ Commented Mar 20, 2019 at 14:34
  • 1
    $\begingroup$ You didn't reply, but anyway: q = Range[i, j, Sign[j - i]]; p = RotateLeft[q]; $\endgroup$ Commented Mar 21, 2019 at 23:20
  • 3
    $\begingroup$ @Mr.Wizard Sorry, I've been out tonight. This won't happen again, I promise ;) Thank you, that is indeed simpler. I took the freedom to incorporate that into my solution (in an updated version with more performance). $\endgroup$ Commented Mar 21, 2019 at 23:35