creating a 'for loop'

I'm trying to create a for loop that will print:
A=1 3 5
6 8 10
11 13 15

1 个评论

Why do you need a for loop and where do you want to print it to? If A is definied in the workspace then just
A
will print it to command line.

请先登录,再进行评论。

回答(1 个)

Try this:
for k = 1:3
V = (1+5*(k-1)):2:5*k
end
Experiment to get the result you want.

类别

在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息

产品

版本

R2018a

标签

Community Treasure Hunt

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

Start Hunting!

Translated by