Error in MATLAB function
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(2 个)
Kaustubha Govind
2013-1-28
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 个评论
Walter Roberson
2013-1-29
T = {alpha,beta,SRD1,SRD2,SRD3,SRC4,D1,D2,D3,D4,C4,C,L};
for K = 1 : nargout
varargout{K} = T{K};
end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Argument Definitions 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!