How can I remove quotes from my struct?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Livia Legnazzi
le 17 Juin 2018
Commenté : Stephen23
le 17 Juin 2018
I have a struct like in the picture (EEG_all.event with 4 fields: type, latency, urevent, duration-each one is 123 rows). How can I remove the quotes from "type"?
0 commentaires
Réponse acceptée
Ameer Hamza
le 17 Juin 2018
If by remove quotes, you mean convert it to numeric format then try
temp = num2cell(str2double({EEG_all.event.type}));
[EEG_all.event.type] = temp{:};
5 commentaires
Stephen23
le 17 Juin 2018
@Livia Legnazzi: your question and this answer are about two different things: you asked how to remove the quotation marks (you can't, because they are not part of the char vector, just how it is displayed), and then you accepted an answer which shows how to convert a char vector to a numeric value. Converting from character to numeric has absolutely nothing to do with "removing" quotation marks.
Plus de réponses (1)
Image Analyst
le 17 Juin 2018
You can't. That's just how the variable editor displays it. You can't get rid of it anymore than you can get rid of the little icons on the column headers at the top of the columns, or the grid lines. They're just part of how MATLAB chooses to display the information. Note that the quotes are not in the data, they're there just for display to indicate that the field value is a string rather than a number. So
length(EEG_all.event(10).type)
will show 3, not 5, meaning that no quotes are in the string.
0 commentaires
Voir également
Catégories
En savoir plus sur Data Type Conversion dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!