Create a column vector from 15 to -25 with a step size of 5

166 ビュー (過去 30 日間)
David Durost
David Durost 2019 年 8 月 30 日
回答済み: Christoph S 2020 年 7 月 28 日
I need help with a problem. Create a column vector from 15 to -25 with a step size of 5. This is what I have prob04=[15;5;-25]; and all I get is a column of just 15,5,-25. I'v tried to resolve it.

回答 (2 件)

Luna
Luna 2019 年 8 月 30 日
Hi David,
Try this:
prob04 = sort(-25:5:15,'descend')

Christoph S
Christoph S 2020 年 7 月 28 日
An easy way to do this would be
prob04 = 15:-5:25;
If you want to turn it into a column vector you can then just use the transpose operator
prob04 = prob04.';

Community Treasure Hunt

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

Start Hunting!

Translated by