Hello sir,
i m doing one program shows some error.
can u help me?
Ie=imread('imd.jpg'); [x,y]=size(Ie);
h=x/2;
for i=1:x
for j=1:y
if Ie(i,j)==0 Ic(i,j)=0;
else if ((Ie(i+1,j-1)==1)& (Ie(i+1,j+1)==1))
Ic(i,j)=0;
else if (((Ie(i+1,j-1)==1)&(i<=h))|(Ie(i+1,j+1)==1) & (i>h))
Ic(i,j)=1;
else if (((Ie(i+1,j+1)==1) & i<=h)|| (Ie(i+1,j-1)==1)& (i>h))
Ic(i,j)=-1;
end %if
end %for
end
"Gaurav Verma" wrote in message <jhbjpr$ph...@newscl01ah.mathworks.com>...
> Hello sir,
> i m doing one program shows some error.
> can u help me?
> Ie=imread('imd.jpg'); > [x,y]=size(Ie);
> h=x/2;
> for i=1:x
> for j=1:y
> if Ie(i,j)==0 > Ic(i,j)=0;
> else if ((Ie(i+1,j-1)==1)& (Ie(i+1,j+1)==1))
> Ic(i,j)=0;
> else if (((Ie(i+1,j-1)==1)&(i<=h))|(Ie(i+1,j+1)==1) & (i>h))
> Ic(i,j)=1;
> else if (((Ie(i+1,j+1)==1) & i<=h)|| (Ie(i+1,j-1)==1)& (i>h))
> Ic(i,j)=-1;
> end %if
> end %for
> end
- - - - - - - - -
I see at least two problems here. First, in the for-loops the index j-1 can equal zero and the indices i+1 and j+1 can be above the range of Ic which will produce an error message. Second, the 'elseif' should not have a space between the 'else' and the 'if'. As it stands it does not have enough end's and that will create a parsing error message when the program is compiled.