Cody

Problem 2. Make the vector [1 2 3 4 5 6 7 8 9 10]

Created by Cody Team in Cody Challenge

In MATLAB, you create a vector by enclosing the elements in square brackets like so:

 x = [1 2 3 4]

Commas are optional, so you can also type

 x = [1, 2, 3, 4]

Create the vector

 x = [1 2 3 4 5 6 7 8 9 10]

There's a faster way to do it using MATLAB's colon notation.

Solution Stats

71.81% Correct | 28.19% Incorrect
Last solution submitted on Nov 18, 2018

Problem Comments

Solution Comments

Recent Solvers25208

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!