(MATLAB)How to stop duplicate outputs in the command window produced by a UsrDef function

I'm new to MATLAB and searched for an answer to my question, no luck. In making a function within a script:
Driver:
V=(2:2:10)
[a,b,c,d] = oneinputfouroutputs(v)
Function script
Function [a,b,c,d] = oneinputfouroutputs(v)
a=1./v
b=1./v^2
c=v./2
d=v./v
....
It prints it in the command window but it duplicates it twice. Also did it to another script function that was less complex...
How do I fix it so that it only provides a single printout in the command window.
Thanks in advance to any answers or help received for this question

답변 (1개)

Walter Roberson
Walter Roberson 2013년 9월 14일
편집: Walter Roberson 2013년 9월 14일
Inside your function, put a semi-colon on the end of every line. For example,
a=1./v;
b=1./v.^2;

댓글 수: 1

Helpful, I have tried it with one function script that was also duplicating in the command window..

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

카테고리

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

질문:

2013년 9월 14일

댓글:

2020년 3월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by