Extract data from cell array

20 vues (au cours des 30 derniers jours)
Christian Schäfer
Christian Schäfer le 8 Sep 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

Réponses (1)

Star Strider
Star Strider le 8 Sep 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.
.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by