MATLAB: How to create a row from x(1) to x(n)

MATLABrow

Hello
I am quite new to coding and trying to create a row where each term in the row is x followed by the column number in brackets. So [x(1) x(2) x(3) … x(n)]
Many thanks

Best Answer

I suggest going through MATLAB Onramp. Chps 4 and 5 seems to be relevant to what you are asking.
You might also just be needing to transpose you column vector to turn it into a row vector. Use ' for that. This is covered in 4.2.6.
x=[1:5]'
x = 5×1
1 2 3 4 5
x1=x'
x1 = 1×5
1 2 3 4 5