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:
STREL input error

Subject: STREL input error

From: Thomas

Date: 8 Sep, 2010 16:18:04

Message: 1 of 4

I'm writing a function that requires creation of a structuring element dependent on some user input.

When I feed STREL(image,uint8) I get:
Function STREL expected its second input, R,
to be one of these types:

  double

Instead its type was uint8.

When I feed STREL(image,double) I get:
Function STREL expected its second input, R, to be integer-valued.

I looked around to see if this is a known error, but couldn't find it. What am I missing here? Thanks in advance.

Subject: STREL input error

From: Sean

Date: 8 Sep, 2010 17:06:06

Message: 2 of 4

"Thomas " <amygdalohippocampus@gmail.com> wrote in message <i68cvs$6ul$1@fred.mathworks.com>...
> I'm writing a function that requires creation of a structuring element dependent on some user input.
>
> When I feed STREL(image,uint8) I get:
> Function STREL expected its second input, R,
> to be one of these types:
>
> double
>
> Instead its type was uint8.
>
> When I feed STREL(image,double) I get:
> Function STREL expected its second input, R, to be integer-valued.
>
> I looked around to see if this is a known error, but couldn't find it. What am I missing here? Thanks in advance.

The numeric value of the second input is supposed to be an integer of class double.
such as:
strel('disk',10)

Subject: STREL input error

From: Thomas

Date: 8 Sep, 2010 17:13:05

Message: 3 of 4

Duh - the intersection of two conditions. Thanks for clearing it up so quickly - fixed the problem.

"Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <i68fpu$f1f$1@fred.mathworks.com>...
> "Thomas " <amygdalohippocampus@gmail.com> wrote in message <i68cvs$6ul$1@fred.mathworks.com>...
> > I'm writing a function that requires creation of a structuring element dependent on some user input.
> >
> > When I feed STREL(image,uint8) I get:
> > Function STREL expected its second input, R,
> > to be one of these types:
> >
> > double
> >
> > Instead its type was uint8.
> >
> > When I feed STREL(image,double) I get:
> > Function STREL expected its second input, R, to be integer-valued.
> >
> > I looked around to see if this is a known error, but couldn't find it. What am I missing here? Thanks in advance.
>
> The numeric value of the second input is supposed to be an integer of class double.
> such as:
> strel('disk',10)

Subject: STREL input error

From: Steven_Lord

Date: 8 Sep, 2010 17:14:35

Message: 4 of 4



"Thomas " <amygdalohippocampus@gmail.com> wrote in message
news:i68cvs$6ul$1@fred.mathworks.com...
> I'm writing a function that requires creation of a structuring element
> dependent on some user input.
>
> When I feed STREL(image,uint8) I get:
> Function STREL expected its second input, R,
> to be one of these types:
>
> double
>
> Instead its type was uint8.
>
> When I feed STREL(image,double) I get:
> Function STREL expected its second input, R, to be integer-valued.
>
> I looked around to see if this is a known error, but couldn't find it.
> What am I missing here? Thanks in advance.

I'm not sure you're using the correct syntax for STREL (unless "image"
contains one of the strings describing a structure element type; if that's
the case, I recommend using a different name so that you don't deny yourself
the ability to call the IMAGE function.)

http://www.mathworks.com/help/toolbox/images/ref/strel.html

Anyway, the second error message indicates that if you pass a double input
as the second input to STREL, the values stored in that double array must be
integer values. For instance, this matrix:

a = [1 2; -3 4]

contains all integer-valued doubles, while this:

b = [pi exp(1); 1.5 sqrt(2)]

does not.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

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