Error showing as using too many output arguments.How to solve this?

2 views (last 30 days)
if true
% %%LOSSY COMPRESSION-DECOMPRESSION USNIG DISCRETE COSINE TRANSFORM TECHNIQUE.
function[]=dct1(filename,n,m)
% "filename" is the string of characters including Image name and its
% extension.
% "n" denotes the number of bits per pixel.
% "m" denotes the number of most significant bits (MSB) of DCT Coefficients.
% Matrix Intializations. N=8; % Block size for which DCT is Computed. M=8; I=imread(filename); % Reading the input image file and storing intensity values in 2-D matrix I. I_dim=size(I); % Finding the dimensions of the image file. I_Trsfrm.block=zeros(N,M); % Initialising the DCT Coefficients Structure Matrix "I_Trsfrm" with the required dimensions.
Norm_Mat=[16 11 10 16 24 40 51 61 % Normalization matrix (8 X 8) used to Normalize the DCT Matrix. 12 12 14 19 26 58 60 55 14 13 16 24 40 57 69 56 14 17 22 29 51 87 80 62 18 22 37 56 68 109 103 77 24 35 55 64 81 104 113 92 49 64 78 87 103 121 120 101 72 92 95 98 112 100 103 99];
save('LenaInitial.txt','I'); end
I have given filename :-'marstest.raw' n=1 m=8
I am getting error as using too many o/p arguments..

Answers (1)

dpb
dpb on 28 Jul 2013
Edited: dpb on 29 Jul 2013
Format the rest of the code for legibility and provide the actual line and error message as seen on the screen to pinpoint where precisely, but it appears the problem is/would be related to
_function[]=dct1(filename,n,m)_
Your function has no return variable(s) defined so if you tried to call it while assigning it to a variable name that's what you'd get. That is, if
noout.m contains
function []=nooout(x)
disp(x)
>> noout
Error using noout (line 2)
Not enough input arguments.
>> noout(1)
1
>> z=noout(1)
Error using noout
Too many output arguments.
>>
Matlab is not C; the value of a function is not returned as the function name but only by assigning return values to the dummy arguments listed in the output list.
doc function

Community Treasure Hunt

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

Start Hunting!