convert Char to string type

474 vues (au cours des 30 derniers jours)
garima sharma
garima sharma le 1 Août 2022
Commenté : Walter Roberson le 1 Août 2022
I am reading data from serial port in the char format. the data format is
data = 1 2.2345
(1*9 char size {including space after 1, and new line character 5})
how to convert char into string?

Réponse acceptée

Walter Roberson
Walter Roberson le 1 Août 2022
  2 commentaires
garima sharma
garima sharma le 1 Août 2022
data_1 = string(data);
this keyword is showing error. "Undefined function 'string' for input arguments of type 'char'."
Walter Roberson
Walter Roberson le 1 Août 2022
Ah I just noticed that you are using r2016a. string() objects were added in r2016b, so you cannot convert to string() objects in your release.
In your release you would use char vectors or cell array of character vectors; see also cellstr()

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Produits


Version

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by