It will occur error when Function sparse is used in simulink model
古いコメントを表示
Hello everyone,
The function sparse is used in simulink model whose name is Embedded MATLAB Function. Embedded MATLAB Function occurs error when it is running and error message is "Undefined function or variable 'sparse'."
About mel-spaced filterbank I have a function which is ok when it is running on matlab,but it will occur error when be used in simulink model as the above-mentioned error.
Matlab version is v7.11.0(R2010b)
code is following:
function x=melbankm(p,n,fs,fl,fh)
f0=700/fs;
fn2=floor(n/2);
lr=log((f0+fh)/(f0+fl))/(p+1);
% convert to fft bin numbers with 0 for DC term
bl=n*((f0+fl)*exp([0 1 p p+1]*lr)-f0);
b2=ceil(bl(2));
b3=floor(bl(3));
b1=floor(bl(1))+1;
b4=min(fn2,ceil(bl(4)))-1;
pf=log((f0+(b1:b4)/n)/(f0+fl))/lr;
fp=floor(pf);
pm=pf-fp;
k2=b2-b1+1;
k3=b3-b1+1;
k4=b4-b1+1;
r=[fp(k2:k4) 1+fp(1:k3)];
c=[k2:k4 1:k3];
v=2*[1-pm(k2:k4) pm(1:k3)];
mn=b1+1;
v=1-0.92/1.08*cos(v*pi/2);
x=sparse(r,c+mn-1,v,p,1+fn2);
採用された回答
その他の回答 (2 件)
Arnaud Miege
2011 年 4 月 11 日
As far as I can tell, sparse is not part of the Embedded MATLAB Subset, as least in R2010b. You therefore need to declare it as an extrinsic function before you can use it:
eml.extrinsic('sparse')
If that doesn't work, you may want to post exactly what error message you're getting.
HTH,
Arnaud
monika sharma
2018 年 7 月 28 日
0 投票
i used eml.extrinsic function and trying to store the output of sparse code in .mat form. But when i am calling my sparse code using eml.extrinsic function, it is not saving those output result in .mat format. Please help me out to figure out this problem. How we can save results of sparse code in workspace while calling sparse code using eml.extrinsic function?
カテゴリ
ヘルプ センター および File Exchange で Modeling についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!