Remove quotation marks from a text string
16 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have an Excel table that I load into Matlab, containing a lookup string, and the name of the cell array (within Matlab) wherein I will find the string. For instance, a row in this table may be:
MSWXAUL saaDataTitles
MSWXAUL will be the contents of one of the cells in saaDataTitles.
What I want to do is determine the location of the lookup string within the cell array. I'm using find(strcmp( )) to do so, which seems to work fine. My issue is that when I load the Excel table, the entries acquire quotation marks, thus:
'MSWXAUL' 'saaDataTitles'
That's fine for the lookup value; but it means that Matlab doesn't recognise the array name as an array name rather than a text string. It's my understanding that it needs to read saaDataTitles rather than 'saaDataTitles'.
How can I get this to work? I'm open to any approach - trimming the first and last characters to get rid of the quotation marks, extracting anything that isn't a quotation mark, changing the nature of the string, loading it via a different method in the first place, whatever else might work - but can't figure out how to do it.
2 commentaires
Yao Li
le 8 Avr 2013
Your purpose is to find out the header name of the column or row. Am I right? So I think it's OK if Matlab returns an array rather than a text string. Why you just need a text string without quotation marks?
Réponse acceptée
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Characters and Strings 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!