function[x,y]=rowcolum(a,b)
x=max(sum(a,2));
y=min(sum(b,1));
end
how to write a code that will sum x+y in main script?

 채택된 답변

Thorsten
Thorsten 2014년 11월 18일

1 개 추천

Why not
z = x + y;

댓글 수: 3

Etan Cole
Etan Cole 2014년 11월 18일
because i must have function that return multiple outputs and the use them seperately
Matt J
Matt J 2014년 11월 18일
편집: Matt J 2014년 11월 18일
But why not simply invoke the function, obtain 2 outputs, and then sum them:
[x,y]=rowcolumn(a,b); %a call to rowcolumn
z=x+y
Etan Cole
Etan Cole 2014년 11월 18일
that was what i wanted thanks man :)

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

추가 답변 (1개)

Matt J
Matt J 2014년 11월 18일
편집: Matt J 2014년 11월 18일

1 개 추천

I assume you want to do the summation outside the workspace, for some reason . If so, then,
outputsRequested=2;
[c{1:outputsRequested}]=rowcolumn(a,b);
result = sum([c{:}])

댓글 수: 2

Etan Cole
Etan Cole 2014년 11월 18일
i want the two outputs and use them seperately. when i call the function in my workspace appears only x and y is no where to be found
You can later assign the output to separate variables if you wish,
x=c{1}
y=c{2}
but why you wouldn't simply use c{1} and c{2} instead of separate variables x and y is not clear.

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

카테고리

도움말 센터File Exchange에서 Cell Arrays에 대해 자세히 알아보기

태그

질문:

2014년 11월 18일

댓글:

2014년 11월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by