Hello, I have so problem with this code segment? When I try to run this program, I receive a error warning "Too many input arguments". Help me to fix this problem! Thank in advance!

for j=0:(floor(nCol/m)-1)
sj = j*m+1;
for i=0:(floor(nRow/m)-1)
si = i*m+1;
if zigzag
| *YVec = [YVec; ZigzagMtx2Vector(Y(si:(si+m-1), sj:(sj+m-1)), ind)];*|
else
YVec = [YVec; reshape(Y(si:(si+m-1), sj:(sj+m-1)), 1, m*m)];
end
end
end
CbVec = [];
CrVec = [];
for j=0:(floor(nCol/s/m)-1)
sj = j*m+1;
for i=0:(floor(nRow/s/m)-1)
si = i*m+1;
if zigzag
CbVec = [CbVec; ZigzagMtx2Vector(Cb(si:(si+m-1), sj:(sj+m-1)), ind)];
CrVec = [CrVec; ZigzagMtx2Vector(Cr(si:(si+m-1), sj:(sj+m-1)), ind)];
else
CbVec = [CbVec; reshape(Cb(si:(si+m-1), sj:(sj+m-1)), 1, m*m)];
CrVec = [CrVec; reshape(Cr(si:(si+m-1), sj:(sj+m-1)), 1, m*m)];
end
end
end
fprintf('zigzag done\n');

 Accepted Answer

Too much code; too little information.
Give us only the actual error in context cut 'n pasted from the screen and the definition line for the function in question.
But, that said, the error is pretty much self-explaining -- you called the function in question with the wrong number of inputs from that which it expects. Look at the documentation/help for that function and compare to what you have in your usage.

3 Comments

Thank for your help. But I had edited my post. Can u show me more specific way to fix this error. Thank you.
Well, you did well by showing the error message but you didn't provide the description for the function being called that is identified as causing the error so can see what it does expect.
But, using the name as a hint, as well as the "too many" part of the error message it would seem likely a matrix is the input. Looking at the argument to the function in you calling statement you have a form that is two arguments. The subscript nesting and the concatenation operations make keeping straight the parentheses nesting an eye-straining task, but
Y(si:(si+m-1), sj:(sj+m-1))
is an array reference, and then there's the second argument variable ind in the function argument list. I replaced the above expression with a placeholder Z below to make the statement more legible only for illustration purposes--
Z=Y(si:(si+m-1), sj:(sj+m-1));
YVec=[YVec; ZigzagMtx2Vector(Z, ind)];
Now what ind is and whether it was intended as part of the subscript expression and got a parenthesis misplaced or what I don't know but there clearly are two arguments being passed and, again, as would be assumed from the error message combined with the name there should only be one.
Again, look at the help for the function you're calling for more details on it...

Sign in to comment.

More Answers (0)

Categories

Find more on Interactive Control and Callbacks 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!