Why does my matlab function produce result more than I expect?

Plus de réponses (1)

Stephen23
Stephen23 le 10 Jan 2016
Modifié(e) : Stephen23 le 11 Jan 2016
Your function Testing has two outputs, and when you call the function the first output is displayed by default, unless you suffix the line with a semicolon. So instead of calling this:
Testing
you need to call this:
Testing;
Note that a function output is a totally different thing to the text that you are fprintf-ing in the command window: do not get confused between these.

3 commentaires

Thank you so much Stephen! I'm very new to Matlab programming and just learned from your answer. Thanks again!
My pleasure. You can also vote for my answer if it helped you.

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB Report Generator dans Centre d'aide et File Exchange

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by