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.
7429 Solvers
363 Solvers
middleAsColumn: Return all but first and last element as a column vector
276 Solvers
184 Solvers
445 Solvers
MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply Today