Clear Filters
Clear Filters

How to separate an Excel column into two columns?

1 view (last 30 days)
I have a column in an Excel sheet that I would like to separate into two columns. The numbers are separated by a comma (Ex. [1, 4]). I would like one column to contain the 1 and the other the 4.
This column could also consist of matrices...looking like {[1, 4], [3, 6]}...I would also like to separate these into two different columns; one containing the 1 and 3, the other the 4 and 6.
I would like to know how to separate a column into two columns by the comma between the two numbers...
  8 Comments
Bob Thompson
Bob Thompson on 15 Feb 2018
Ok, so depending on the data type inside the cell you can go back to the original suggestion for string manipulation. You just need to have an index to make sure you are looking inside your cell.
Jan
Jan on 20 Feb 2018
@Lexington: Your question is still not clear. Does it concern Excel or Matlab? "[1, 4] or {[1, 4], [3, 6]}" This is a substantial difference. While the first is a vector, the second is a cell, which contains two vectors. Therefore I do not have an idea about what your inputs are and what you want as output.
separate a column into two columns by the comma between the two numbers
This is not meaningful, because the vectors do not contain a comma. This comma is just inserted for the output on the screen. A vector consists of 2 elements only, not of square brackets or commas. "Columns" are something you know from Excel, but this is a Matlab forum and here a "column" is not a known object. Change your point of view to arrays, not columns.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!