Info

此问题已关闭。 请重新打开它进行编辑或回答。

Store specific values 1 off the diagonal

1 次查看(过去 30 天)
Tim Navr
Tim Navr 2016-4-5
关闭: Tim Navr 2016-4-5
I have n number of boxes, all along the diagonal and need to place them into different cells. Thank you
So, I have a 6000 by 6000 matrix and the majority of the values are 0. Non zero values are spread in a number of clusters (which are all along the diagonal, although the diagonal itself is 0). I need to check all the values along the diagonal( send a messenger from 1,1 to 6000,6000). At first he will encounter 0, so do nothing. Then, he will come across some values and I need to store x and y coordinates in the first cell or matrix. Then, he will come across 0 and i need to stop the storing process. Next time he encounters a >0 again, start second and third and so on cells. x and y are the row and column numbers. example A= 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0
From the matrix A I need to store the row and column numbers of 2,2 in first cell and 4,4 and 5,5 in the second cell. Except all of my values are around the diagonal with the diagonal itself being 0 Thanks for your help
  1 个评论
Azzi Abdelmalek
Azzi Abdelmalek 2016-4-5
What are x and y? what values do you want to sytore? Please try to make your question clear. You can post a short example a 6x6 Matrix for example, then post an expected result with some explanations.

回答(0 个)

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by