How to remove the display of ans on a function
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
smaug66
il 23 Feb 2018
Modificato: Fangjun Jiang
il 23 Feb 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 =
'********'
0 Commenti
Risposta accettata
Fangjun Jiang
il 23 Feb 2018
Modificato: Fangjun Jiang
il 23 Feb 2018
TriangleA(10);
Add the semicolon ; at the end
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Entering Commands in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!