How to remove the display of ans on a function

1 view (last 30 days)
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 =
'********'

Accepted Answer

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

Sign in to comment.

More Answers (0)

Categories

Find more on Entering Commands in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!