Prev: Convert 3D slice in matrix
Next: Matrix return values
From: Matt Fig on 27 Jul 2010 21:57 Why start another thread on the same topic? Keep one thread going if the subject is the same.
From: ravi gtg on 27 Jul 2010 22:08 thank you matt to be honest , I knew how to get it like that but what I was really hinting at a way of getting my solution without using the 'find' function. My situtation is actually where I would have a non-homogeneous matrix for example: A = [ 0 2 2 0; 0 2 31 0; 0 31 31 0] So finding the extents of the 2 and 31 regions respectively would be impractical as I am dealing with matrices far greater than these. If you or anyone can help tht'll be great thanks ravi
From: dpb on 27 Jul 2010 23:07 ravi gtg wrote: > thank you matt to be honest , I knew how to get it like that but what I > was really hinting at a way of getting my solution without using the > 'find' function. > > My situtation is actually where I would have a non-homogeneous matrix > for example: > > A = [ 0 2 2 0; > 0 2 31 0; > 0 31 31 0] > > So finding the extents of the 2 and 31 regions respectively would be > impractical as I am dealing with matrices far greater than these. Well, if you're not going to specify the problem, I'm not interested in trying to ferret it out... :( --
From: ravi gtg on 27 Jul 2010 23:56 dqb, i do not intend for you to "ferret" out the problem, infact I tried to simplify my problems to explain it as clear as possible. Sorry if I missed something and thanks for the help. So, my exact situation is as follows: I have a matrix: Rs =[ 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 3 3 3 3 3 3 0 0; 0 0 0 0 0 0 3 3 3 0 4 0; 0 0 0 0 0 5 0 0 0 4 4 0; 0 0 0 0 5 5 0 0 0 4 4 0; 0 0 0 0 5 5 0 0 0 4 4 0; 0 0 0 0 5 0 6 6 6 0 4 0; 0 0 0 0 0 6 6 6 6 6 0 0; 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0] Now I have number regions of '3' , '4' , '5' and '6'. Now, this matrix can vary in size depending on the data I input. So, as I said I want the starting and ending row and column values of each number region. I hope I am more clear now.thanks again ravi
From: Oleg Komarov on 28 Jul 2010 03:45
> Now I have number regions of '3' , '4' , '5' and '6'. > Now, this matrix can vary in size depending on the data I input. So, as I said I want the starting and ending row and column values of each number region. > > I hope I am more clear now.thanks again > ravi A question, for region '5' you consider the start as the number 5 in row 5 or 6? Since matlab operates rowwise by default the first number considered by find would be that in line 6. Oleg |