From: Samiov on
dpb <none(a)non.net> wrote in message <hteop3$vf$1(a)news.eternal-september.org>...
> Samiov wrote:
> > Walter Roberson <roberson(a)hushmail.com> wrote in message
> > <QuzKn.29577$rE4.27388(a)newsfe15.iad>...
> ...
>
> > I got it now, it simplifies a lot the code but don't know how to use
> > it...But what does it means 1,'last'?
>
> This is getting _really_, _really_ tiresome... :(
>
> Do you _EVER_ read the documentation???
_____________________________________________________________
Sorry, I saw the documentation but didn't see it clearly that's all.. but hope you'll understand that I have problems of comprehension because English is not my native language..and It's hard for me to understand everything..
_____________________________________________________________

> > ind = find(X, k, 'last') returns at most the last k
> > indices corresponding to the nonzero entries of X.
>
>
> amongst other very useful information and some examples of using find()
> that just _might_ be instructive if you would simply take the time to
> read them and study them a little...
_______________________________________________________________
It would be easier if I had much time, but my problem is that I haven't enough time to study it with calm, I must deliver my project Thursday
_______________________________________________________________
> So, look at the documentation on the use of the debug statement and read
> the sections in "Getting Started" on debugging applications and work out
> where your logic or implementation is going wrong...
_______________________________________________________________
There's no debug statement. doesn't display any error message but it gives me bad results..doesn't match with the figure that I have here http://drop.io/mqlwmho#
From: dpb on
Samiov wrote:
> dpb <none(a)non.net> wrote in message
> <hteop3$vf$1(a)news.eternal-september.org>...
>> Samiov wrote:
>> > Walter Roberson <roberson(a)hushmail.com> wrote in message >
>> <QuzKn.29577$rE4.27388(a)newsfe15.iad>...
>> ...
>>
>> > I got it now, it simplifies a lot the code but don't know how to use
>> > it...But what does it means 1,'last'?
>>
>> This is getting _really_, _really_ tiresome... :(
>>
>> Do you _EVER_ read the documentation???
> _____________________________________________________________
> Sorry, I saw the documentation but didn't see it clearly that's all..
> but hope you'll understand that I have problems of comprehension because
> English is not my native language..and It's hard for me to understand
> everything..
> _____________________________________________________________
>
>> > ind = find(X, k, 'last') returns at most the last k
>> > indices corresponding to the nonzero entries of X.
>>
>>
>> amongst other very useful information and some examples of using
>> find() that just _might_ be instructive if you would simply take the
>> time to read them and study them a little...
> _______________________________________________________________
> It would be easier if I had much time, but my problem is that I haven't
> enough time to study it with calm, I must deliver my project Thursday
> _______________________________________________________________
> > So, look at the documentation on the use of the debug statement and read
>> the sections in "Getting Started" on debugging applications and work
>> out where your logic or implementation is going wrong...
> _______________________________________________________________
> There's no debug statement. doesn't display any error message but it
> gives me bad results..doesn't match with the figure that I have here
> http://drop.io/mqlwmho#

>> help debug

Debugging commands.

dbstop - Set breakpoint.
dbclear - Remove breakpoint.
dbcont - Resume execution.
dbdown - Change local workspace context.
dbmex - Enable MEX-file debugging.
dbstack - List who called whom.
dbstatus - List all breakpoints.
dbstep - Execute one or more lines.
dbtype - List M-file with line numbers.
dbup - Change local workspace context.
dbquit - Quit debug mode.

When a breakpoint is hit, MATLAB goes into debug mode, the debugger
window becomes active, and the prompt changes to a K>. Any MATLAB
command is allowed at the prompt.

To resume M-file function execution, use DBCONT or DBSTEP.
To exit from the debugger use DBQUIT.

>>

--
From: dpb on
dpb wrote:
> Samiov wrote:
....

>> There's no debug statement. doesn't display any error message but it
>> gives me bad results..doesn't match with the figure that I have here
>> http://drop.io/mqlwmho#

So, that's a logic error. As noted, by Steve, you need to calm down and
approach it systematically and work through what your code is doing that
is different from what you would do if you were solving the problem by
hand w/ pencil and paper.

>
> >> help debug
>
> Debugging commands.
....

That was for my very outdated version...for current look at

<http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_env/brqxeeu-175.html>

or the local copy of the documentation on your system.

Undoubtedly an hour or so invested there now would pay much larger
dividends in helping you get where you want/need to go...

--
From: Samiov on
dpb <none(a)non.net> wrote in message <hter0q$7gh$2(a)news.eternal-september.org>...
> >> help debug
>
> Debugging commands.
>
> dbstop - Set breakpoint.
> dbclear - Remove breakpoint.
> dbcont - Resume execution.
> dbdown - Change local workspace context.
> dbmex - Enable MEX-file debugging.
> dbstack - List who called whom.
> dbstatus - List all breakpoints.
> dbstep - Execute one or more lines.
> dbtype - List M-file with line numbers.
> dbup - Change local workspace context.
> dbquit - Quit debug mode.
>
> When a breakpoint is hit, MATLAB goes into debug mode, the debugger
> window becomes active, and the prompt changes to a K>. Any MATLAB
> command is allowed at the prompt.
>
> To resume M-file function execution, use DBCONT or DBSTEP.
> To exit from the debugger use DBQUIT.
___________________________________________________________________
Ah Ok, I see what you mean, thanks for the info, I will try to use them to see where's the problem in my code..thanks again..
From: Walter Roberson on
Samiov wrote:

> for jj = 1:1:col
> for ii = row:-1:1
> if I(ii,jj) == 1;
> x1 = ii;
> y1 = jj;
> x2 = find(I(1:x1-2,y1)==1 & I(2:x1-1,y1) == 0, 1, 'last');
> y2 = find(I(x1,y1+2:col)==1 & I(x1,y1+1:col-1) == 0, 1,
> 'last'); end end end

You are not leaving the loop after you have found what you want, and you
are not testing the result of find() to see whether anything was found
or not.