Simple Use of Strings

1 visualización (últimos 30 días)
Phil Sibley
Phil Sibley el 4 de Abr. de 2018
Editada: Stephen23 el 4 de Abr. de 2018
I am simply trying to get through a Tutorial online and am having a problem running a simple string. It is returning the error:Undefined function 'string' for input arguments of type 'char'.
I am typing: >> a = string('Hi how are you') Undefined function 'string' for input arguments of type 'char'.
This is my first time using MatLab. Do I have to engage this feature to use it? I am pretty sure I have it typed in correctly.
  3 comentarios
Phil Sibley
Phil Sibley el 4 de Abr. de 2018
I am using version 2016a which answers the question. I did find that by typing in:
a={'Hello' 'Goodbye'; 'Yes' 'No'; 'what are you doing' 'by the way'}
it seems to solve the same function. What is the difference?
Stephen23
Stephen23 el 4 de Abr. de 2018
Editada: Stephen23 el 4 de Abr. de 2018
Different classes of data:
a = {...} % cell array
b = "..." % string
Some functions accept inputs arguments of different classes, some don't. It depends on the function.
By the way, the best place to start to learn MATLAB is here:

Iniciar sesión para comentar.

Respuesta aceptada

Stephen23
Stephen23 el 4 de Abr. de 2018
Editada: Stephen23 el 4 de Abr. de 2018
Your version of MATLAB does not support the string class.
"String arrays were introduced in R2016b":

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by