필터 지우기
필터 지우기

help on matlab code error

조회 수: 1 (최근 30일)
mutah
mutah 2013년 11월 13일
댓글: Image Analyst 2013년 11월 13일
function varargout=mixtureplot(mix,varargin)
mix.dist(1:6)=='Expone'
% define the grid on the x-axis
M=1000; % number of grid points
[ss is]=sort(mix.par); %sort the means to define the domain of the plot
cl=0.01; % define the lower bound from the lower quantile
cu=0.95; % define the upper bound from the upper quantile
x=linspace(-log(1-cl)/mix.par(is(mix.K)),-log(1-cu)/mix.par(is(1)),M);
pd=mixturepdf(mix,x);
plot(x,pd,'k');
end
when I call this function by
par=struct('mu',[ -1 2]);
mix=struct('dist','Exponential','K',2,'weight',[0.5 0.5 ],'par',par);
mixtureplot(mix)
gave me this error
Undefined function 'sort' for input arguments of type 'struct'.
Error in mixtureplot (line 232) [ss is]=sort(mix.par); %sort the means to define the domain of the plot
any one help me for this error??

답변 (1개)

Image Analyst
Image Analyst 2013년 11월 13일
mix.par is a structure. It doesn't automatically know that it should take the "mu" field of the par structure to do its sorting on. Try mix.par.mu and see if that works.
  댓글 수: 2
mutah
mutah 2013년 11월 13일
Do you mean I must to change on [ss is]=sort(mix.par);
to became [ss is]=sort(mix.par.mu); or what ?
if you mean that , i worked that but still the error
Image Analyst
Image Analyst 2013년 11월 13일
What does "i worked that but still the error" mean? Did it work or not?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by