Next Post:

What Is The Batch Production In Manufacturing(Illustrated Expression)

Assigning Characters To A Variable In MatLab®(Illutstrated Expression)

Assigning characters to variables is the very basic process in Matlab®. But it can be forgotten by Matlab® users and they can not remember how was it. Or you are a new learner of Matlab® and decided to learn Matlab® from Mechanical Base. In this article, we will show how to assign characters to variables in Matlab®.

How To Assign Characters To Variables In Matlab®?

>> a = 'mechanicalbase'
size(a)

a =

    'mechanicalbase'


ans =

     1    14

>> 

We created an ‘a’ variable that its value is not an integer or number etc. Its value is ‘mechanical base’. So its value is assigned as a character inside the ‘’. This is the general rule of assigning characters to variables in Matlab®.

As you can see by the red arrow above that we used a command called ‘size()’ which gives the dimensions of the vector or matrix that typed inside the brackets of this command in Matlab®. So we typed the variable ‘a’ inside it, it gave the numbers of 1 and 14 respectively as shown above. This means Matlab® took the variable ‘a’ as a 1×14 matrix. ‘mechanical base’ word has 14 characters inside it.

Conclusion

Do not forget to leave your comments and questions below about assigning characters to variables in Matlab® below. 

If you want further coding examples about assigning characters to variables in Matlab®, inform us in the comments.

This article is prepared for completely educative and informative purposes. Images used courtesy of Matlab®

Your precious feedbacks are very important to us.

  • Site Comments

At least 10 characters required.