why do I receive error "Not enough Argument" (2024)

I am writting codes to a s-function block to create demo or animate of a liquid Tank ,but I have a problem which is "not enough Arguments".I am not sure if you know what is the problem,I have paste my written codes below.

function [sys,x0,str,ts,setPt1,setPt2,waterx1,vessel1Hndl,vessel1Ht, vesselHndlList,waterY1,vessel2Hndl,lineHndl1,lineHndl2]=vesseldemo2project (u,flag,t,x)

switch flag==4

case 0

[sys,x0,str,ts,vesseldemo2project]=mdlInitializeSizes;

get(vesseldemo2project,'UserData') =vesselHndlList;

get( vesselHndlList(1),'YData');

yData(1)=yOffset;

yData(3:4)=[1 1]*u(2)+yOffset;

set( vesselHndlList(1),'YData',yData);

yData=get(x(2),'YData');

yData([3 4])=[1 1]*u(2)+yOffset;

set(x(2),'YData',yData);

yData=[1 1]*u(1)+1;

set(x(3),'YData',yData);

case 2

%Tank body details.................................

sys=mdlUpdate(t,x,u);

vessel1Ht=1;

vessel1Wid=1;

vessel1Init=0;

setPt1=0.5;

setPt2=0.75;

vesselx=[0 0 1 1]-0.5;

vesselY=[1 0 0 1];

line(1.1*vesselx*vessel1Wid+1,vesselY*vessel1Ht+0.95,'LineWidth',2,'Color','black');

% Draw the water..............................................

waterx1=vesselx*vessel1Wid+1;

waterx=vesselY*vessel1Init+1;

x=patch(waterx,waterx,'blue','EdgeColor','none');

% Draw the gray wall............................................

waterY1([1 2 5])=vessel1Ht*[1 1 1]+1;

waterY([3 4 ])=x*[1 1 ]+1;

vessel2Hndl=patch(waterx,waterY,[.9 .9 .9],'EdgeColor','none');

case 3

str = [];

ts = [.1 0];

vessel1Wid=1;

vessel1Ht=1;

vessel1Init=0;

setPt1=0.5;

setPt2=0.75;

vesselx=[0 0 1 1]-0.5;

vesselY=[1 0 0 1];

waterx1=vesselx*vessel1Wid+1;

waterx=vesselY*vessel1Init+1;

waterY1([1 2 5])=vessel1Ht*[1 1 1]+1;

waterY([3 4 ])=vessel1Init*[1 1 ]+1;

vessel1Hndl=patch(waterx,waterx,'blue','EdgeColor','none');

vessel2Hndl=patch(waterx,waterY,[.9 .9 .9],'EdgeColor','none');

lineHndl1=line([0 0.4],setPt1*[0.5 0.5]+1,'Color','red','LineWidth',4);

hlod on

lineHndl2=line([0 0.4],setPt2*[0.75 0.75]+1,'Color','red','LineWidth',4);

hold on

set(gcf, ...

'Color',[.9 .9 .9], ...

'UserData',[vessel1Hndl vessel2Hndl lineHndl]);

set(gca, ...

'XLim',[0 2],'YLim',[0 3.5], ...

'XColor','black','YColor','black', ...

'Box','on');

axis equal

xlabel('Water Level Control','Color','black','FontSize',10);

set(get(gca,'XLabel'),'Visible','on');

x0=0;

otherwise

error(message('vesseldemo:vesseldemo2project:UnhandledFlag', flag));

end

why  do I receive error "Not enough Argument" (2024)

References

Top Articles
Latest Posts
Article information

Author: Patricia Veum II

Last Updated:

Views: 5938

Rating: 4.3 / 5 (44 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Patricia Veum II

Birthday: 1994-12-16

Address: 2064 Little Summit, Goldieton, MS 97651-0862

Phone: +6873952696715

Job: Principal Officer

Hobby: Rafting, Cabaret, Candle making, Jigsaw puzzles, Inline skating, Magic, Graffiti

Introduction: My name is Patricia Veum II, I am a vast, combative, smiling, famous, inexpensive, zealous, sparkling person who loves writing and wants to share my knowledge and understanding with you.