Debugger won't step into software at first line with this code.

My code is:
function n = palin_product( dig,lim )
if isnumeric(dig)== false
n = 0;
return;
end
if isnumeric(lim)==false
n = 0;
return;
end
c = floor(dig)
multiplier1=10^c;
multiplier1 = multiplier1-1;
L=num2string(lim);
len = length(L)
if ceil(L/2)-floor(L/2)==0
nucount=L/2;
else
numcount =floor(L/2);
end
for q =lim:-1:1
consider= q;
L = num2string(q)
if ceil(L/2)-floor(L/2)==0
nucount= L/2;
else
nucount= floor(L/2);
end
test =false;
for count = 0:nucount-1
if L(0+count) == L(len-count);
test =true
else
test = false
end
if count ==true
n = q;
end
end
end
if test ==false
n =0;
end
end
THe description of the problem is:
Matlab will not let me start tracing software to look for errors in its behavior. It won't got to the first "if" statement when I call the function. What is wrong?

2 件のコメント

Walter Roberson
Walter Roberson 2016 年 12 月 10 日
It would not stop there if the function is not being called, or if it is being called with too many arguments. Re-check the file name, and make sure that you have dig and lim defined when you invoke the function. Are any error messages being produced?
Walter Roberson
Walter Roberson 2016 年 12 月 10 日
Undefined function or variable 'num2string'.
num2str is the function name.
if L(0+count) == L(len-count);
Remember that MATLAB subscripts start at 1.
test = false
When the test becomes false then you should not be continuing the iterations. See "break"

サインインしてコメントする。

回答 (0 件)

質問済み:

2016 年 12 月 10 日

コメント済み:

2016 年 12 月 10 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by