How do I find what row and column a specific element is in?

377 views (last 30 days)
I am trying to create a sudoku solver for a project and I can't find a way to find which row and column an element is in. For example if I had a 9 by 9 matrix I want to know what row and column a specific element is in. Such as element number 11 would be in row 2 column 2.

Accepted Answer

Guillaume
Guillaume on 30 Apr 2015
You can't have looked that far. Use find:
m = magic(3);
[row, column] = find(m == 7)
  6 Comments

Sign in to comment.

More Answers (1)

Bjorn Gustavsson
Bjorn Gustavsson on 30 Apr 2015
Seems you're asking for
sub2ind
HTH

Categories

Find more on Sudoku in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!