matlab - Set breakpoint within a different function using dbstop -


my main.m goes

clear dbstop in a.m if a1>3 x=1; y=2; a(x,y) 

the a.m goes

function [a1, a2] = a(x,y)    a1=x+y    a2=x-y    while a1<5       a1=a1+1    end end 

but when run main.m, face following error.

breakpoint expression 'a1>3' resulted in error.  error undefined function or variable 'a1' 

why case?

i tried main.m looks like

clear x=1; y=2; a(x,y) dbstop in a.m @ 5 if a1>3 

but results in same error message.

as have noted, can use dbstop set breakpoint in file given specific condition. trick condition has able able evaluated @ every in relevant file a.m if not specify particular line number breakpoint.

if @ function a, you'll see a1 not defined on first line (i.e. it's not input argument , doesn't defined until next line) results in error.

i recommend setting breakpoint @ specific line. in case, i'm assuming want catch @ point within while loop maybe set conditional breakpoint @ line 5.

dbstop in a.m @ 5 if a1>3 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -