MATLAB Answers

0

Comma separated value to vector

I have a table where the element in the first row of the second column is "11,333,4445,2,78,2399". I would like to take this element, remove the commas, and turn it into a vector v=[11 333 4445 2 78 2399].

  0 Comments

Sign in to comment.

1 Answer

Answer by Stephen Cobeldick on 9 May 2019
 Accepted Answer

>> S = '11,333,4445,2,78,2399';
>> V = sscanf(S,'%f,',[1,Inf])
V =
11 333 4445 2 78 2399

  1 Comment

Brilliant! This is exactly what I need. Thank you.

Sign in to comment.