why i am having error.. NOT ENOUGH INPUT ARGUMENTS
Show older comments
function [ y ] = template1( x )
y = x;
aa(1:42,1:24)=1;
aa(1:42,1)=0;
aa(1:42,24)=0;
aa(1,1:24)=0;
aa(42,1:24)=0;
imwrite(aa,'pen.bmp','bmp');
A=imread('A.bmp');
B=imread('B.bmp');
C=imread('C.bmp');
D=imread('D.bmp');
E=imread('E.bmp');
F=imread('F.bmp');
G=imread('G.bmp');
H=imread('H.bmp');
I=imread('I.bmp');
J=imread('J.bmp');
K=imread('K.bmp');
L=imread('L.bmp');
M=imread('M.bmp');
N=imread('N.bmp');
O=imread('O.bmp');
P=imread('P.bmp');
Q=imread('Q.bmp');
R=imread('R.bmp');
S=imread('S.bmp');
T=imread('T.bmp');
U=imread('U.bmp');
V=imread('V.bmp');
W=imread('W.bmp');
X=imread('X.bmp');
Y=imread('Y.bmp');
Z=imread('Z.bmp');
Afill=imread('fillA.bmp');
Bfill=imread('fillB.bmp');
Dfill=imread('fillD.bmp');
Ofill=imread('fillO.bmp');
Pfill=imread('fillP.bmp');
Qfill=imread('fillQ.bmp');
Rfill=imread('fillR.bmp');
%Number
one=imread('1.bmp');
two=imread('2.bmp');
three=imread('3.bmp');
four=imread('4.bmp');
five=imread('5.bmp');
six=imread('6.bmp');
seven=imread('7.bmp');
eight=imread('8.bmp');
nine=imread('9.bmp');
zero=imread('0.bmp');
zerofill=imread('fill0.bmp');
fourfill=imread('fill4.bmp');
sixfill=imread('fill6.bmp');
sixfill2=imread('fill6_2.bmp');
eightfill=imread('fill8.bmp');
ninefill=imread('fill9.bmp');
ninefill2=imread('fill9_2.bmp');
a1=imread('pen.bmp');
%*-*-*-*-*-*-*-*-*-*-*-
letter=[A Afill B Bfill C D Dfill E F G H I J K L M ...
N O Ofill P Pfill Q Qfill R Rfill S T U V W X Y Z];
number=[];
character=[];
number=[one two three four fourfill five six sixfill sixfill2 seven ...
eight eightfill nine ninefill ninefill2 zero zerofill a1];
character=[letter number];
NewTemplates=mat2cell(character,42,[24 24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 ...
24 24 24 24 24 24 24 24]);
save ('NewTemplates','NewTemplates')
end
5 Comments
Bob Thompson
on 6 Mar 2018
Which line is giving you the error?
Akilan A
on 6 Mar 2018
Bob Thompson
on 6 Mar 2018
Edited: Bob Thompson
on 6 Mar 2018
So, y = x;, or somewhere in the blob of text that relates to letter, number, character, etc.?
Walter Roberson came through and did some cleaning to make your script a bit more readable for simple people like me.
If I were to take a guess, I would think that the save command wants you to do something like:
save('NewTemplates',NewTemplates) % Specifying NewTemplates as a variable rather than an input argument
Bob Thompson
on 6 Mar 2018
Would you be willing to post the specific error message you're getting? That would help me have a bit more clarity on what I need to be looking at.
Answers (1)
The error message means, that x is not defined. This happens, if you start this function using the "Run" button in the editor without providing an input.
But the input is not used at all. You copy it to the variable y, which is replied to the caller. Therefore it looks better to modify the code to:
function = template1()
aa(1:42,1:24) = 1;
...
By the way: It is more reliable to replace repeated code by a loop:
A=imread('A.bmp');
B=imread('B.bmp');
...
Z=imread('Z.bmp');
by:
Letter = char(['A':'Z', '0':'9']);
for k = 1:numel(Letter)
Data.(['Char', Letter(k)]) = imread([Letter(k), '.bmp']);
end
Categories
Find more on MATLAB Support Package for Arduino Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!