I want to create a function that does not return a value, but instead plots something on a given interval.
I learned programming with C, and in C the following syntax was used: void fname(input_type inp).
What's the analogue for this in MATLAB?

 採用された回答

Friedrich
Friedrich 2013 年 7 月 9 日
編集済み: Friedrich 2013 年 7 月 9 日

38 投票

Hi,
%void myfun(void)
function myfun()
%void myfun(double a)
function myfun(a)
So in your case something like that I guess:
function myfun(a,b)
plot(a:b)
And call it with
myfun(1,7)

2 件のコメント

Omulus
Omulus 2013 年 7 月 13 日
Thanks.
Cedric
Cedric 2013 年 7 月 13 日
編集済み: Cedric 2013 年 7 月 13 日
Don't forget to [ Accept the Answer ] if it solved your problem.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Get Started with MATLAB についてさらに検索

製品

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by