Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

retriveing some specific value from several matrix

1 visualizzazione (ultimi 30 giorni)
Mohammad Golam Kibria
Mohammad Golam Kibria il 31 Mag 2011
Chiuso: MATLAB Answer Bot il 20 Ago 2021
Hi suppose I have some matrix of same size.I,I1,I2,I3. among them I as follows
I =
1 1 1 1 8 1 2
1 1 8 8 8 2 1
1 8 8 1 2 1 1
1 1 8 2 1 1 1
2 2 2 1 1 1 1
2 2 2 1 1 1 1
In I there are 3 distinct value 1,2 and 8.
I have declared a variable cell as follows:
InformationFromMatrix=cell(max(I(:))+1,1);
In each cell I need to store the following information:
There are seven 8.but seven of them are in boundary position with 1 and 2.
I need the following information in the 3rd cell:
8 1 1 5 1 4 column7 column8 column9
8 1 1 5 1 6 column7 column8 column9
8 1 3 2 2 2 column7 column8 column9
.....................................
8 2 3 3 4 4 column7 column8 column9
8 2 4 3 4 4 column7 column8 column9
.....................................
......................................
column1=8 ; 3rd distinct value
column2=1; one of 8's boundary value
column3= row index of the 8
column4= column index of the 8
column4= row index of the 1
column5= column index of the 1
column7 =absolute difference of I1 of position(1,5) and (1,4)
column8 =absolute difference of I2 of position(1,5) and (1,4)
column9 =absolute difference of I3 of position(1,5) and (1,4)
this so on will be for 1st and 2nd cell.
Is there any body to help me?
Thanks in advance.
  1 Commento
Oleg Komarov
Oleg Komarov il 31 Mag 2011
What if an 8 (row 4, col 3) has two 2s and a 1 in the boundary (four connected compenents), which one to chose?

Risposte (0)

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by