Of Cell Arrays & Sort
1 次查看(过去 30 天)
显示 更早的评论
Greetings,
for i=1:5
x{i}=i
end
for j=1:7
y{j}=j
end
merge_twocell = [x y]
Now say I have a variable, select_var and I want to select the lowest 3 values from x and 4 lowest values from y, how can I achieve this?
P/S I'm avoiding using cell2mat, sort the elements, then retrieve what I want. Is there a more direct approach?
0 个评论
采纳的回答
Azzi Abdelmalek
2012-9-6
编辑:Azzi Abdelmalek
2012-9-6
x1=sortrows(x);y1=sortrows(y);
x_min=x1(1:3)
y_min=y1(1:4)
3 个评论
Azzi Abdelmalek
2012-9-6
编辑:Azzi Abdelmalek
2012-9-6
I did'nt see it was a cell, Now I use sortrows instead of sort
x1=sortrows(x);y1=sortrows(y);
x_min=x1(1:3)
y_min=y1(1:4)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!