switching output based on input
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, is it possible to switch the output of a function based on the input that was given to the function? im talking about switching to diffderent number and types of output?
thank you
0 件のコメント
回答 (1 件)
Azzi Abdelmalek
2013 年 10 月 2 日
You can use if else statement
6 件のコメント
Azzi Abdelmalek
2013 年 10 月 2 日
Example
function varargout=ans_switch(a)
if a==1
varargout{1}=10
varargout{2}=20
else
varargout{1}=100
end
% to call this function
% If a==1
[out1,out2]=ans_switch(1)
% If a~=1
out1=ans_switch(12)
参考
カテゴリ
Help Center および File Exchange で Dates and Time についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!