Aashish T
Aashish T

Reputation: 490

Can a function be created in MATLAB that returns nothing?

I want to write a function that does some image processing and writes the processed images to files. I don't want it to return anything. I can always return a dummy variable which can be ignored, but I'd like to keep my code clean. How can I achieve this in MATLAB?

Upvotes: 23

Views: 35554

Answers (1)

dinkelk
dinkelk

Reputation: 2786

Yes.

function [] = my_awesome_function(image,filename,other_inputs)
    % Do awesome things.
end

will return nothing. An even simpler version:

function my_awesome_function(image,filename,other_inputs)
    % Do awesome things.
end

is equivalent.

Upvotes: 54

Related Questions