How to remove the display of ans on a function

1 回表示 (過去 30 日間)
smaug66
smaug66 2018 年 2 月 23 日
編集済み: Fangjun Jiang 2018 年 2 月 23 日
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 =
'********'

採用された回答

Fangjun Jiang
Fangjun Jiang 2018 年 2 月 23 日
編集済み: Fangjun Jiang 2018 年 2 月 23 日
TriangleA(10);
Add the semicolon ; at the end
  1 件のコメント
smaug66
smaug66 2018 年 2 月 23 日
My bad. I write functions but can't seem to use them. Thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by