Error in MATLAB function

6 visualizaciones (últimos 30 días)
Siddhartha Singh
Siddhartha Singh el 28 de En. de 2013
Hi! I am using following code as a function but there is some error occured
function [varargout]=deap(s)
%******************************
[C,L]=wavedec(s,4,'db4');%Scale 128
C4=appcoef(C,L,'db4',4);
D4=detcoef(C,L,4); %Scale 64
D3=detcoef(C,L,3);%Scale32
D2=detcoef(C,L,2);%Scale 16
D1=detcoef(C,L,1);%Scale 8
[C,L]=wavedec(s,4,'db4');
SRC4=wrcoef('a',C,L,'db4',4);
SRD4=wrcoef('d',C,L,'db4',4);
SRD3=wrcoef('d',C,L,'db4',3);
SRD2=wrcoef('d',C,L,'db4',2);
SRD1=wrcoef('d',C,L,'db4',1);
alpha=(SRD4);%?-wave(8~13Hz)
beta=(SRD3);%?-wave(14~30Hz)
varargout={alpha,beta,SRD1,SRD2,SRD3,SRC4,D1,D2,D3,D4,C4,C,L};
the error is *"Error in deap (line 3)
[C,L]=wavedec(s,4,'db4');%Scale 128
Output argument "y" (and maybe others) not assigned during call to "C:\Users\SID\Desktop\deap.m>deap"* Please help me any one . Thanks in advance.

Respuestas (2)

Kaustubha Govind
Kaustubha Govind el 28 de En. de 2013
Your MATLAB Function block's Ports and Data Manager probably configures "y" as an output, which is never assigned in your function. Note that you cannot have a variable number of outputs for the MATLAB Function block, so you may instead what to replace varargout with (alpha,beta,SRD1,SRD2,SRD3,SRC4,D1,D2,D3,D4,C4,C,L) in your function prototype.
  2 comentarios
Siddhartha Singh
Siddhartha Singh el 29 de En. de 2013
Thank you for giving your comment . After running this code then i went to command line and then just type y=deap(s); then got this error . Please clear me little bit more
Kaustubha Govind
Kaustubha Govind el 1 de Feb. de 2013
What about if you try Walter's solution?

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 29 de En. de 2013
T = {alpha,beta,SRD1,SRD2,SRD3,SRC4,D1,D2,D3,D4,C4,C,L};
for K = 1 : nargout
varargout{K} = T{K};
end

Categorías

Más información sobre Argument Definitions en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by