Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

dpb
dpb am 11 Mär. 2015
doc textscan % NB: 'delimiter' Name-Value Pair with example for multiple delimiter characters.
  6 Kommentare
dpb
dpb am 12 Mär. 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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by