Arranging the cell array in the corresponding rows.
古いコメントを表示
I have a cell array which has the following format: action (a1,a2,a3,...) and followed by the corresponding "id-number" like(01,02,03,.....) i want to generate an output in which all the unique "id-number" belongs to one group.
if true
c_in = {'a1ev01','a1ev02','a2ev01','a2ev02','a3ev01','a3ev02'}; % and so on....
% output
c_out = {'a1ev01','a2ev01','a3ev01';...
'a1ev02','a2ev02','a3ev02';}; % or in another format of the same form
end
1 件のコメント
Cedric
2014 年 5 月 8 日
Is there the same number of elements for each group/ID?
採用された回答
その他の回答 (1 件)
the cyclist
2014 年 5 月 8 日
Related to Cedric's question in his comment ... Is it a simple reshape?
c_out = reshape(c_in,2,[])
2 件のコメント
pr
2014 年 5 月 8 日
If there is always the same number of elements per group/ID and the order follows always the same schema, you (pr) can perform a reshape based on an appropriate number of rows or columns. If the second condition falls, there is a little more work but you can still store the outcome in a rectangular cell array. If both conditions fail, you must build a cell array of cell arrays.
カテゴリ
ヘルプ センター および File Exchange で Standard File Formats についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!