For loops for printing pattern in matlab
이전 댓글 표시
I am quite new to matlab and just like in python I want to get familiar with loops in matlab therefore I was trying to print the following pattern.
#####
####
###
##
#
When I am using the disp() function everything is being printed on the same line.
채택된 답변
추가 답변 (1개)
str = '#' ;
for i = 5:-1:1
s = repmat(str,1,i) ;
fprintf('%s\n',s) ;
fprintf('\n')
end
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!