How to read comma separated input data containing values & stings which also has ',' & ';' used for separation?

3 vues (au cours des 30 derniers jours)
How to read comma separated input data containing values & stings which also has ',' & ';' used for separation?
Example:
#SATVISA,COM1_30,0,88.5;COARSESTEERING,1833,167463.000,00400000,0947,12996;TRUE,TRUE,30,16,0,0,79.0,111.5

Réponse acceptée

dpb
dpb le 11 Mar 2015
doc textscan % NB: 'delimiter' Name-Value Pair with example for multiple delimiter characters.
  6 commentaires
dpb
dpb le 12 Mar 2015
Use the 'collectoutput',1 name-value pair to put the string and numeric data into separate (still cell) arrays. Again I repeat, you can not put the two types of data in the same array; just not possible.
You can then use cell2mat on the numeric array to get a regular array of numeric values; again you leave out pertinent details of what data are to go together for plotting, etc., so that's a detail to deal with.
Or, of course, to use the cell array as is, you "use the curlies" the {} brackets to dereference the content of a cell. Read the doc on cell arrays for the details there.
Again, specific examples of what you want to do help more than just generalizations.
Shree
Shree le 12 Mar 2015
I will try this approach. Thank you so much!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Cell Arrays 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!

Translated by