Build matrix from corresponding table variables stored in cell array
4 ビュー (過去 30 日間)
古いコメントを表示
Hello, I have a number of tables with identical variables, stored as elements in a cell array. For example:
NoOfCells = randi([5 10]); % generate number of tables
C = cell(NoOfCells,1); % preallocate
% generate cell array of tables with same variable names
for i = 1:NoOfCells
A = rand(3);
T = array2table(A);
T.Properties.VariableNames = {'Col1' 'Col2' 'Col3'};
C{i,1} = T;
end
Wht I would like to now do is build a matrix from Col1 of each table, essentially wihtout using a for loop (I know how to do it with a for loop).
I was thinking somehting like:
D = [C{:}.Col1]
This unfortunatelly produces: Intermediate brace '{}' indexing produced a comma-separated list with 8 values, but it must produce a single value when followed by subsequent indexing operations.
How could it be done?
Regards,
Cristian
0 件のコメント
採用された回答
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!