Extract data from cell array

20 ビュー (過去 30 日間)
Christian Schäfer
Christian Schäfer 2021 年 9 月 8 日
回答済み: Star Strider 2021 年 9 月 8 日
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 Center および File ExchangeLogical についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by