Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
multistructuring element

Subject: multistructuring element

From: arpit singhal

Date: 15 Apr, 2011 13:20:52

Message: 1 of 5

se=strel('disk',1);
N=2;
alfa=22.5;
for i=1:(4*N-1)
    k=i*alfa
    t=imrotate(se,k)
    b(i)=t
end
 i am getting an error in this program. actually i want to rotate the
structuting element and the want to store them in different variable,
as here i am taking variable as b1,b2,b3 and so on . the rotation part
is ok but an error always come in line "b(i)=t ... what to do ..plz
help

Subject: multistructuring element

From: Florin Neacsu

Date: 15 Apr, 2011 16:02:20

Message: 2 of 5

arpit singhal <arpitsinghal2787@gmail.com> wrote in message <050d777c-ce1f-424f-b708-bbdb70159a29@j13g2000pro.googlegroups.com>...
> se=strel('disk',1);
> N=2;
> alfa=22.5;
> for i=1:(4*N-1)
> k=i*alfa
> t=imrotate(se,k)
> b(i)=t
> end
> i am getting an error in this program. actually i want to rotate the
> structuting element and the want to store them in different variable,
> as here i am taking variable as b1,b2,b3 and so on . the rotation part
> is ok but an error always come in line "b(i)=t ... what to do ..plz
> help

Hello,

Running your code (matlab R2007b) I get an error before b(i)=t. It has to do with imrotate :
>A must be a non-sparse numeric or logical array.

se is class strel. I do not think you can apply imrotate to strel.

Regards,
Florin

Subject: multistructuring element

From: arpit singhal

Date: 16 Apr, 2011 04:49:06

Message: 3 of 5

On Apr 15, 9:02 pm, "Florin Neacsu" <fneac...@gmail.com> wrote:
> arpit singhal <arpitsinghal2...@gmail.com> wrote in message <050d777c-ce1f-424f-b708-bbdb70159...@j13g2000pro.googlegroups.com>...
> > se=strel('disk',1);
> > N=2;
> > alfa=22.5;
> > for i=1:(4*N-1)
> >     k=i*alfa
> >     t=imrotate(se,k)
> >     b(i)=t
> > end
> >  i am getting an error in this program. actually i want to rotate the
> > structuting element and the want to store them in different variable,
> > as here i am taking variable as b1,b2,b3 and so on . the rotation part
> > is ok but an error always come in line "b(i)=t ... what to do ..plz
> > help
>
> Hello,
>
> Running your code (matlab R2007b) I get an error before b(i)=t. It has to do with imrotate :
>
> >A must be a non-sparse numeric or logical array.
>
> se is class strel. I do not think you can apply imrotate to strel.
>
> Regards,
> Florin

so is there any way of rotationg the structuring element and the
storing them in different variable

Subject: multistructuring element

From: arpit singhal

Date: 16 Apr, 2011 04:54:23

Message: 4 of 5

On Apr 16, 9:49 am, arpit singhal <arpitsinghal2...@gmail.com> wrote:
> On Apr 15, 9:02 pm, "Florin Neacsu" <fneac...@gmail.com> wrote:
>
>
>
> > arpit singhal <arpitsinghal2...@gmail.com> wrote in message <050d777c-ce1f-424f-b708-bbdb70159...@j13g2000pro.googlegroups.com>...
> > > se=strel('disk',1);
> > > N=2;
> > > alfa=22.5;
> > > for i=1:(4*N-1)
> > >     k=i*alfa
> > >     t=imrotate(se,k)
> > >     b(i)=t
> > > end
> > >  i am getting an error in this program. actually i want to rotate the
> > > structuting element and the want to store them in different variable,
> > > as here i am taking variable as b1,b2,b3 and so on . the rotation part
> > > is ok but an error always come in line "b(i)=t ... what to do ..plz
> > > help
>
> > Hello,
>
> > Running your code (matlab R2007b) I get an error before b(i)=t. It has to do with imrotate :
>
> > >A must be a non-sparse numeric or logical array.
>
> > se is class strel. I do not think you can apply imrotate to strel.
>
> > Regards,
> > Florin
>
> so is there any way of rotationg the structuring element and the
> storing them in different variable

on using any matrix still i am still getting same error ... how to
remove it
se=[1 1 1;0 0 0;1 1 1];
N=2;
alfa=22.5;
for i=1:(4*N-1)
    k=i*alfa;
    t=imrotate(se,k);
    for k=1:(4*N-1)
        b(k)=t
    end
end

error in line b(k)=t

Subject: multistructuring element

From: Florin Neacsu

Date: 18 Apr, 2011 17:27:06

Message: 5 of 5

arpit singhal <arpitsinghal2787@gmail.com> wrote in message <c0c52a17-f4bc-498a-b65e-ebb48cbc0c47@z7g2000prh.googlegroups.com>...
> On Apr 16, 9:49 am, arpit singhal <arpitsinghal2...@gmail.com> wrote:
> > On Apr 15, 9:02 pm, "Florin Neacsu" <fneac...@gmail.com> wrote:
> >
> >
> >
> > > arpit singhal <arpitsinghal2...@gmail.com> wrote in message <050d777c-ce1f-424f-b708-bbdb70159...@j13g2000pro.googlegroups.com>...
> > > > se=strel('disk',1);
> > > > N=2;
> > > > alfa=22.5;
> > > > for i=1:(4*N-1)
> > > >     k=i*alfa
> > > >     t=imrotate(se,k)
> > > >     b(i)=t
> > > > end
> > > >  i am getting an error in this program. actually i want to rotate the
> > > > structuting element and the want to store them in different variable,
> > > > as here i am taking variable as b1,b2,b3 and so on . the rotation part
> > > > is ok but an error always come in line "b(i)=t ... what to do ..plz
> > > > help
> >
> > > Hello,
> >
> > > Running your code (matlab R2007b) I get an error before b(i)=t. It has to do with imrotate :
> >
> > > >A must be a non-sparse numeric or logical array.
> >
> > > se is class strel. I do not think you can apply imrotate to strel.
> >
> > > Regards,
> > > Florin
> >
> > so is there any way of rotationg the structuring element and the
> > storing them in different variable
>
> on using any matrix still i am still getting same error ... how to
> remove it
> se=[1 1 1;0 0 0;1 1 1];
> N=2;
> alfa=22.5;
> for i=1:(4*N-1)
> k=i*alfa;
> t=imrotate(se,k);
> for k=1:(4*N-1)
> b(k)=t
> end
> end
>
> error in line b(k)=t

Hi,

Indeed. Why is that ? What does your error say ? Have a look at what imrotate does, especially at the matrix size for the output.
Also, your for loop doesn't make much sense (in Matlab coding I mean). You can assign matrices directly (if that is what you are trying to do).

Regards,
Florin

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us