Each number on telephone keypads, except 0 and 1, corresponds to a set of uppercase letters as shown in this list: 2 ABC, 3 DEF, 4 GHI, 5 JKL, 6 MNO, 7 PQRS, 8 TUV, 9 WXYZ Hence, a phone-number specification can include uppercase letters and digits.
조회 수: 10 (최근 30일)
이전 댓글 표시
I can not quite figure out why my code does not perform. I keep getting syntax errors that dont make sense to me. Such as "parse errors"
댓글 수: 3
Star Strider
2019년 1월 3일
Please copy and paste your code from your Editor window to a Comment here.
Pictures of code are like pictures of food — enticing but not nourishing.
답변 (3개)
Neil Sheridan
2019년 1월 3일
Firstly sizeof isn't a function (on my MATLAB setup) so I changed to size. Also, use == to check equality of numbers.
for i = 1 : size(up)
if boolean(i) == 0
telephone = [];
end
end
댓글 수: 14
Neil Sheridan
2019년 1월 4일
When a character is not found in characters() then coords(i) will be 0. numbers(0) will return an error because there is no zeroth element.
댓글 수: 0
RAMAKANT SHAKYA
2019년 2월 7일
function s2=dial(n)
p=[n];
s1='';
tx = ismember(p, ['A':'Z','0':'9']);%only digits and capital letters
tx1=sum(tx);
if length(p)<=16&& p(1,1)~='0'&& tx1==length(p) %finding letters
for c=1:length(p)
if p(c)=='A' || p(c)=='B' || p(c)=='C'
s='2';
elseif p(c)=='D' || p(c)=='E' || p(c)=='F'
s='3';
elseif p(c)=='G' || p(c)=='H' || p(c)=='I'
s='4';
elseif p(c)=='J' || p(c)=='K' || p(c)=='L'
s='5';
elseif p(c)=='M' || p(c)=='N' || p(c)=='O'
s='6';
elseif p(c)=='P' || p(c)=='Q' || p(c)=='R' || p(c)=='S'
s='7';
elseif p(c)=='T' || p(c)=='U' || p(c)=='V'
s='8';
elseif p(c)=='W' || p(c)=='X' || p(c)=='Y' || p(c)=='Z'
s='9';
else
for r=0:9 %finding digit if present
t=num2str(r);
if p(c)==t
s=t;
end
end
end
s1=strcat(s1,s); %adding string
s2=str2num(s1); %change into number
s2=uint64(s2); %changing class
end
else
s2=uint64(0);
end
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!