create non uniform increment vector

3 vues (au cours des 30 derniers jours)
Oday Shahadh
Oday Shahadh le 12 Juin 2020
Réponse apportée : KSSV le 12 Juin 2020
hi
how can I in a single command creat this vector:
a=12345678910987654321
thanks

Réponses (2)

Robin Kirsch
Robin Kirsch le 12 Juin 2020
Modifié(e) : Robin Kirsch le 12 Juin 2020
a = [1:10 9:-1:1]
a =
Columns 1 through 13
1 2 3 4 5 6 7 8 9 10 9 8 7
Columns 14 through 19
6 5 4 3 2 1

KSSV
KSSV le 12 Juin 2020
k = num2str([1:10 9:-1:1]) ;
k(k == ' ') = [] ;
k

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by