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 CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by