(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 件のコメント

Samuel Katongole
Samuel Katongole 2020 年 3 月 20 日
Helpful, I have tried it with one function script that was also duplicating in the command window..

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMATLAB 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