Cell array containing cell arrays
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi there,
Im trying to extract particular information from each cell. I have 124 cells and in each cell contains 4 cells. I want to extract the pressure cells in each cell.
4 Commenti
dpb
il 1 Lug 2017
Modificato: dpb
il 1 Lug 2017
Pictures don't really help much in the details as we can't do anything with them but look and if it's not just trivial that generally isn't enough. Better would be to save one of these variables to .mat file and attach that.
Show the actual code that got those loaded; it's likely can get the complexity reduced and thus make the referencing simpler.
Even better would be to attach a (small) set of the initial data that created them to attack it from the beginning instead of trying to straighten it out from the other end...
Stephen23
il 7 Lug 2017
Modificato: Stephen23
il 7 Lug 2017
@mohamed abdinasir: please edit your original question and:
- upload any files by clicking the paperclip button. Do not put huge amounts of code in a comment or question: it makes the thread unreadable.
- clearly explain what your question is, best would be to provide complete input and output examples as well.
Risposte (2)
Walter Roberson
il 1 Lug 2017
cellfun( @(S) S.pressure, allstates, 'Uniform', 0 )
I did not put all of those into one array as we do not know that all of the pressure entries are the same size, and we do not know if you would want them arranged as rows or columns or just all put together into one large vector.
I speculate you might want
cell2mat( cellfun( @(S) S.pressure, allstates(:).', 'Uniform', 0 ) )
which would arrange them as columns.
2 Commenti
dpb
il 2 Lug 2017
Modificato: dpb
il 2 Lug 2017
It's the dummy argument to the anonymous function argument to cellfun
Look up anonymous functions for details
I'd reiterate the comments given earlier above about showing us how you got to this point and give us something real we can do something with besides looking at pictures.
Image Analyst
il 2 Lug 2017
Modificato: Image Analyst
il 2 Lug 2017
In one of the pictures I see "1-124" for the row index of allstates. That will give a value of -123 and you can't have the minus 123rd row of a matrix. Perhaps you meant 1:124, meaning rows 1 through 124.
1 Commento
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!