How do i convert a numerical cell array in a vector ?
Show older comments
I have a data table imported from Excel with 304 rows and 75 columns.
At the position {10,30} for example i have a cell with comma delimitation like this:
Arr = {'5,6,16,17,19,21,25,27,28'}
I would like that in the position {10,76} of my matrix there is the same string of numbers converted into row vector.
Accepted Answer
More Answers (1)
Sebastian Bomberg
on 29 Oct 2019
str2num(Arr{:})
1 Comment
I would be very careful with using str2num on arbitrary input coming from an excel file. str2num is a dangerous function that will happily eval whatever text it is passed so somebody could easily craft an excel file that would make str2num format the hard drive or other nastiness.
e.g. on window see the effect of:
Arr = {'system(''notepad'')'}
str2num(Arr{1}) %opens notepad
Categories
Find more on Data Type Conversion 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!