Course Content

Course Content


A vector in MATLAB is a matrix with one row or one column. It's critical to understand the difference between row and column vectors. Many programming problems occur when a row vector is used instead of a column vector, and vice versa.

Square brackets [] are used to form column vectors, with semicolons or newlines used to divide elements. The transpose operator can be used to convert a row vector to a column vector (and vice versa).

The length of the greatest array dimension in X is returned by L = length(X). The length of a vector is just the number of elements. The length of an array with more dimensions is max(size(X)).

To make an array containing several elements in a single row, use a comma ',' or a space to separate the elements. A row vector is the name for this sort of array. To make an array with several elements in a single column, use semicolons ';' to divide the elements. A column vector is the name for this sort of array.

x = input(prompt) shows the prompt text and waits for the user to enter a value and press the Return key. The user can use variables in the workspace and enter equations like pi/4 or rand(3). Input returns an empty matrix if the user pushes the Return key without entering anything.

Recommended Courses

Share With Friend

Have a friend to whom you would want to share this course?

Download LearnVern App

App Preview Image
App QR Code Image
Code Scan or Download the app
Google Play Store
Apple App Store
598K+ Downloads
App Download Section Circle 1
4.57 Avg. Ratings
App Download Section Circle 2
15K+ Reviews
App Download Section Circle 3
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere