من کد زیر رو وقتی اجرا میکنم با خطای Index exceeds matrix dimensions مواجه میشم (خط شماره 11)
function result = isKaprekarNumber2(number)
result=0;
lenOfNumber = length(num2str(number));
numberArray = num2str(number);
sqOfNumber = number.^2;
sqNumberArray = num2str(sqOfNumber);
sqHead= sqNumberArray(1:lenOfNumber);
sqTail= sqNumberArray(lenOfNumber+1:lenOfNumber+lenOfNumber);
result=0;
lenOfNumber = length(num2str(number));
numberArray = num2str(number);
sqOfNumber = number.^2;
sqNumberArray = num2str(sqOfNumber);
sqHead= sqNumberArray(1:lenOfNumber);
sqTail= sqNumberArray(lenOfNumber+1:lenOfNumber+lenOfNumber);
متلب پروژه Changed status to publish نوامبر 16, 2021