How can I split data into categories based on one element in a cell?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
dpb
2019-2-25
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... :)
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!