Split cell arrays into seperate matrix; Indexing problem with cell array
Ältere Kommentare anzeigen
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 Kommentar
Stephen23
am 27 Aug. 2020
"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.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!