How to extract particular row values from cell arrays with varying cell lengths?
Afficher commentaires plus anciens
Dear Matlab users, I am new to Matlab and especially handling cell arrays. I need assistance! I hope I find a solution.
I have a struct array, in that there are 2 cell arrays (Signal and Label), each of size 1*117 cell and each cell has different dimensions. So, label are from numbered from 1 to 4, and they are always in a sequence like 4,4,4,1,1,1,2,2,2,3,3,4,4,4,4,1.... so on. When label starts with 1 and ends 4 it is taken as 1 fragment/segment. It can have any number of 1,2,3,4 in them.So I want to extract first fragment from each cell (all 117) such that it comes with signal and label in one struct or 2 different cell arrays so that I can use it for training and further classification.
How would you extract it? Thank you in advance :)
here are images for the reference: total_states are labels numbered from 1 to 4, total_state_test_recordings are signal values for each label.
Also, note. dimensions for labels and signal for each cell is same.

1*117 cell of label values (total_states)

first cell of label

first cell of signal

9 commentaires
dpb
le 5 Sep 2022
We can do nothing with images and the description/storage is complicated -- attach a (smallish) example dataset and provide what is the expected result as well.
Bhakti Khera
le 5 Sep 2022
Bhakti Khera
le 5 Sep 2022
dpb
le 6 Sep 2022
Use paperclip icon and attach in the forum, not w/ external link
Bhakti Khera
le 6 Sep 2022
dpb
le 6 Sep 2022
We only need a representative small sample, not the whole thing...save only a half-dozen or so array elements for demo purposes...
Bhakti Khera
le 6 Sep 2022
Modifié(e) : Bhakti Khera
le 6 Sep 2022
There's nothing changing in any of those arrays -- we don't need megabytes of data and the vectors don't have to be long, but they do have to be representative of the problem. These clearly aren't.
However, it dawns on me this appears to be a very similar searching problem as one I had in another application -- I wrote a set of helper functions there to deal with locating and processing data between two indexing rows that ended up working nicely. It, however, had sections identified by a same string with a keyword; I'll have to dig those up and look at how that would match up with the IDs you've got.
That will NOT be tonight; have other commitments to deal with first...that will give you time to put together a representative dataset.
Bhakti Khera
le 7 Sep 2022
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

