How to remove the display of ans on a function

1 visualización (últimos 30 días)
smaug66
smaug66 el 23 de Feb. de 2018
Editada: Fangjun Jiang el 23 de Feb. de 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 =
'********'

Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 23 de Feb. de 2018
Editada: Fangjun Jiang el 23 de Feb. de 2018
TriangleA(10);
Add the semicolon ; at the end
  1 comentario
smaug66
smaug66 el 23 de Feb. de 2018
My bad. I write functions but can't seem to use them. Thanks!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Entering Commands en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by