numeric array to cell array
3 次查看(过去 30 天)
显示 更早的评论
Hi
I want to convert the following numeric array to cell array of cells having two elements each. Any help?
stress = [0 20 -160 150 -40 330 -40 170 -20 180]
what is required is:
cycles = [[0 20] [-160 150] [-40 330] [-40 170] [-20 180]]
2 个评论
采纳的回答
Azzi Abdelmalek
2013-6-12
编辑:Azzi Abdelmalek
2013-6-12
cycles=reshape(stress,2,[])
%you can also create cell array
out=arrayfun(@(x) cycles(:,x),1:size(cycles,2),'un',0)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Stress and Strain 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!