Extract data from cell array

20 visualizaciones (últimos 30 días)
Christian Schäfer
Christian Schäfer el 8 de Sept. de 2021
Respondida: Star Strider el 8 de Sept. de 2021
Dear all,
I'm struggling a bit with extracting the data from a cell array B so that I can continue working with it. It is of type 10x1 cell where each cell contains two dimensional line profile data (2047x2 double). The idea is to extract every profile line out of B and calculate different surface roughness parameters. My question now is:
Currently I'm extracting the data with:
L1 = B{1,1}
L2 = B{2,1}
etc.
The function cell2table doesn't really work in my case, since the output of it is a 10x1 table. Is there an easier solution to extract the data? Maybe with a for loop?
Thanks a lot for helping
Christian

Respuestas (1)

Star Strider
Star Strider el 8 de Sept. de 2021
Perhaps cell2mat would work. or alternatively, adding square brackets to concatenate the cell contents:
L1 = [B{1,1}]
L2 = [B{2,1}]
Assigning the cells to individual variables (numbered or not) is not considered to be good programming practice in any event, so please avoid that if at all possible. Keep the elements of ‘B’ in an array of some description, and refer to the elements of the array instead.
.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by