How to create a void function in MATLAB?

190 Ansichten (letzte 30 Tage)
Omulus
Omulus am 9 Jul. 2013
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?

Akzeptierte Antwort

Friedrich
Friedrich am 9 Jul. 2013
Bearbeitet: Friedrich am 9 Jul. 2013
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 Kommentare
Omulus
Omulus am 13 Jul. 2013
Thanks.
Cedric
Cedric am 13 Jul. 2013
Bearbeitet: Cedric am 13 Jul. 2013
Don't forget to [ Accept the Answer ] if it solved your problem.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by