From: dale on
Sorry, I got it thanks. Used pixellist
From: Ross on
"dale " <persad34(a)gmail.com> wrote in message <i2pfrd$93h$1(a)fred.mathworks.com>...
> Ross,
>
> thanks for the reply.
>
>
> is there any way I can get the values in the matrix,i.e. the value 1 and 2. without manually having to input it into the array.
>
> ps: if you got any ideas how to get the end rows and cols in my code feel free to hit me with them. Suggestions from anyone else would be grateful.
>
> thanks
> dale

Hi

Without the image processing toolbox, I'd try something like this:

values = unique(Rs1(:));
filler=0;
values(values==filler)=[]; %don't include the zeros

for k=1:numel(values)

[r,c]=find(Rs1==values(k)); % this returns lists of row & column indices

%get the min and max of r and c
rmin=min(r); rmax=max(r);
cmin=min(c); cmax=max(c);

%put the min and max values in the right places in RV
RV(k)=rmin; RV(k+numel(values))=rmax;
RV2(k)=cmin; RV2(k+numel(values))=cmax;
end

code not tested

cheers
ross
From: Image Analyst on
dale:
There's also a BoundingBox property, in case that might be more what you want, or a more direct way of getting it.
From: dale on
Thanks a lot. Appreciate it.