Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to output optional variables in a function call?

조회 수: 1 (최근 30일)
yashvin
yashvin 2015년 6월 15일
마감: Walter Roberson 2015년 6월 15일
Hi, I have a function where i want to either output a, b OR c given my input condition which is found in num.
I am getting an error. Output argument "b" (and maybe others) not assigned during call.
Can you please suggest a solution!
For example,
if num=2, i want to output a=10, b=5 and if num=4, i want to output c=100
if true
function [a,b,c] = trial_function(num)
if num==2
a=10; b=5
else if num==4
c=100;
end
end
end

답변 (0개)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by