2
votes

I have a cell array sized 14676x117 call myCellArray. I want to extract values stored in myCellArray{2:14676,1} in an string array. runnning below script only returns a single string value and do not return an string array.

>> y= myCellArray{2:14676,1}
   y = 
      "test1"

How can I convert this cell array range to and string array?

2
Does each cell contain one (scalar) string? I’m not sure why you are able to index with curly braces twice in that example, it doesn’t make sense to me. Could you please include a short script that generates something like your myCellArray? Just a few elements, not all 14k of them of course.Cris Luengo
@CrisLuengo Sorry it was a typo. I fixed it. My cell array is generated by importing an excel worksheet as a cell array. its firs column is name of objects which are strings.VSB

2 Answers

6
votes

Try:

y = string(myCellArray{2:14675, 1})

If you have MATLAB 2016b or newer, this should work.

Source: Create String Arrays

0
votes

Use char command:

c = char(myCellArray(2:14675, 1))