Extract data from cell array

20 次查看(过去 30 天)
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

回答(1 个)

Star Strider
Star Strider 2021-9-8
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.
.

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by