You can convert a cell containing a single value to a double using the following function:
main.m116 chars3 lines
Here, str2double
is used to convert the string in the cell to double. cell_data{1}
is used to access the string in the first (and only) element of the cell array. The resulting double is stored in double_data
.
Note that if the cell contains multiple values, you will need to loop over the cell array and convert each value individually. If the cell contains non-numeric data, str2double
will return NaN
(not a number).
gistlibby LogSnag