I'm having trouble converting a column in my MATLAB table. Each row of this column contains a 802x1 double. For each row in this column, I'd like to merge all of the numbers into one large string (basically so I can have a flat table instead of a nested table). I'm able to do it for one row at a time using:
>> num2str(reshape(data.Wavelength{1}',1,{}))
but is there a way to do them all in a cell function? How do I go about this when the data is already in a table format?
Asked
Active
Viewed 575 times
0

Katie
- 13
- 2
-
Assign the table to a variable using readtable(). After that point you can just dot-index it. e.g. table.varName3 will be the 3rd column of your table. – GuarneerFPS Oct 21 '21 at 06:36
-
I realize I can dot index the column, but my issue is I don't know how to manipulate it. I need to convert each row of this column into a string instead of an array of doubles – Katie Oct 21 '21 at 13:00
-
You can use num2str in a loop to iterate over all of the elements. e.g str(i) = num2str(varNameX(i)), where varNameX stands for the X'th column of the table – GuarneerFPS Oct 21 '21 at 13:52