Matlab function solve number pattern

1 次查看(过去 30 天)
Please some one help me in this number pattern How to write this code?

回答(1 个)

Doddy Kastanya
Doddy Kastanya 2021-1-12
The following code listing should do it (ignore the zeros in the output):
cnt=0;
for i=1:5
for j=1:i
cnt=cnt+1;
y(i,j)=cnt;
if cnt==12
break
end
end
end
y

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by