How to remove the display of ans on a function

1 vue (au cours des 30 derniers jours)
smaug66
smaug66 le 23 Fév 2018
Modifié(e) : Fangjun Jiang le 23 Fév 2018
I did this function to draw a triangle for a homework. How do I remove "ans=" from the display window?
function [s] = TriangleA(n)
%fhdfh
x = [];
for i = 1 : n;
x = strcat(x,'*');
s = [blanks(n-i) x];
disp(s)
end
>> TriangleA(8)
*
**
***
****
*****
******
*******
******
ans =
'********'

Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 23 Fév 2018
Modifié(e) : Fangjun Jiang le 23 Fév 2018
TriangleA(10);
Add the semicolon ; at the end
  1 commentaire
smaug66
smaug66 le 23 Fév 2018
My bad. I write functions but can't seem to use them. Thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Entering Commands dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by