What is the result of the following command? x = 5 : -2 : 1

7 Ansichten (letzte 30 Tage)
Rabia Seyma Gencyigit
Rabia Seyma Gencyigit am 1 Jul. 2021
Beantwortet: Supriya am 7 Jul. 2023
Help

Antworten (2)

Yazan
Yazan am 1 Jul. 2021
Your command has the form: x = x1:stp:x2, where x1 is the starting value, x2 is the end value, and stp is the step. Applying that to your example, x will go from 5 to 1 with a step of -2. Therefore, x = [5, 3, 1].

Supriya
Supriya am 7 Jul. 2023
X=5:--2:1

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by