How can I split data into categories based on one element in a cell?

1 view (last 30 days)
Janna Hinchliff
Janna Hinchliff on 25 Feb 2019
Commented: dpb on 25 Feb 2019
I have data stored in a cell in the form
dataovenparamcell = {oventemp,ovencurrent,timeto50,data};
where there are 6 1x4 cell arrays within dataovenparamcell where oventemp, ovencurrent and timeto50 are single numbers and data is an mxn matrix array. I want to group my data using the ovencurrent variable, such that each of the 6 1x4 arrays are grouped into cells with the same ovencurrent. For example, in one case, I have a data set where the six values of ovencurrent are 9, 11, 13, 9, 11, 13. I want to make this into 3 cell arrays - one for 9, one for 11 and one for 13. This would look something like
dataovenparamcell1 = {{oventemp, 9, timeto50, data} {oventemp, 9, timeto50, data}}
dataovenparamcell2 = {{oventemp, 11, timeto50, data} {oventemp, 11, timeto50, data}}
dataovenparamcell3 = {{oventemp, 13, timeto50, data} {oventemp, 13, timeto50, data}}
How could I go about doing this?
  1 Comment
dpb on 25 Feb 2019
Make it easy for somebody to give you code...attach a dataset.
It's much easier to just write code to a specific problem when don't have to try to create the dataset first...I'm generally too lazy to do the latter but may often do the former... :)

Sign in to comment.

Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by