How to create a void function in MATLAB?

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에 대해 자세히 알아보기

제품

태그

질문:

2013년 7월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by