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

2 次查看(过去 30 天)
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

采纳的回答

dpb
dpb 2015-3-11
doc textscan % NB: 'delimiter' Name-Value Pair with example for multiple delimiter characters.
  6 个评论
dpb
dpb 2015-3-12
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by