How to remove the display of ans on a function
1 回表示 (過去 30 日間)
古いコメントを表示
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 =
'********'
0 件のコメント
採用された回答
Fangjun Jiang
2018 年 2 月 23 日
編集済み: Fangjun Jiang
2018 年 2 月 23 日
TriangleA(10);
Add the semicolon ; at the end
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Entering Commands についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!