Split cell arrays into seperate matrix; Indexing problem with cell array
古いコメントを表示
Hello guys, thank you very much in advance. I woul like to split up a cell array (NxM) with (1xR) double elements in each cell into m matrix or tables with (NxM).
For your further information about my situation: I have different simulation settings (NxM) and i have different result outputs which are the data in each cell (1xR).
My goal is to get a matrix or table for each result. That means I want R matrix with (NxM) Data of the fitting result
Maybe you could help me with a neat solution
a={[1,2],[1,2],[1,2];[1,2],[1,2],[1,2];[1,2],[1,2],[1,2]} %easy number exmaple
%%%%%%%%%%
Result1=[1,1,1;1,1,1;1,1,1]%Result matrix 1; Result1 through indexing of a
Result2=[2,2,2;2,2,2;2,2,2]%Result matrix 2;Result2 through indexing of a
This is probably trivial but I am not able to make it work without using a for-loop. And everytime I use a for-loop i get stuck with the variable naming of the result matrix.
Thank you very much!
1 件のコメント
Stephen23
2020 年 8 月 27 日
"And everytime I use a for-loop i get stuck with the variable naming of the result matrix."
Why do you want to force yourself into writing slow, complex, obfuscated, buggy code that is hard to debug?
Indexing is much neater, simpler, more efficient, less buggy, and easier to debug.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!