Creating a row by 1 matrix
1 view (last 30 days)
Show older comments
Hi, I'm still a beginner in MATLAB. I wanna create a matrix with row by 1 . Row is a variable. Let say row = 4 then I want MATLAB to display it like below
1
2
3
4
how can i write the code to automatically generate it with increment by 1?
0 Comments
Accepted Answer
the cyclist
on 30 Nov 2014
One of many way to do this:
variable = (1:row)'
2 Comments
the cyclist
on 30 Nov 2014
I'll add a few more as other answers. Most would be rather obscure or silly to actually use for this purpose, but you can see some interesting functions.
More Answers (3)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!