Reading in data from irregular xls/text file
Show older comments
I have data in an xls file, in which cells have the following structure "[0.35,0.57,0.77,0.98];[];[0.42,0.73,0.93,1.12];[];[0.37,0.62,0.82];[0.43,0.67,0.87,1.07];"
this is just one example of one xls-cell, and each cell will look slightly different, i.e. different number of values within brackets, some empty brackets etc . When reading this in using xlsread, this is turned into a cell/char.
So I need to turn this into a num in which this order is preserved, but am uncertain how to do this efficiently. That is, in the example above I'd need something like x =
[1x4 double]
[]
[1x4 double]
[]
[1x3 double]
[1x4 double]
[1x4 double]
[1x4 double]
[1x3 double]
[1x2 double]
[]
[1x2 double]
[1x2 double]
Any suggestions are much appreciated
1 Comment
per isakson
on 23 Jan 2014
Edited: per isakson
on 23 Jan 2014
Is x as a cell array of double good enough?
Answers (1)
Azzi Abdelmalek
on 23 Jan 2014
a={[0.35,0.57,0.77,0.98];[];[0.42,0.73,0.93,1.12];[];[0.37,0.62,0.82];[0.43,0.67,0.87,1.07]}
cell2mat(a')
Categories
Find more on Data Import and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!