MATLAB Char Array Definition Guide

In Matlab, you can define char arrays using single or double quotes.

Single quotes can be used to define a character array, for example:

arr = 'hello world'

Double quotation marks can be used to define a string array, for example:

arr = "hello world"

Both single and double quotes can be used to define multi-line character arrays, just remember to add a newline at the end of each line. For example:

arr = ['hello'
       'world']

Note that single quotes create a character array, while double quotes create a string array. Each element of a character array is a character, while each element of a string array is a string.

bannerAds