Finding a range in an array
1 次查看(过去 30 天)
显示 更早的评论
Hi MATLAB pros!
I have an array that's like this, it's a 3D plot converted into 2D pcolor plot
x =
11 15 16 18 20 25
y =
10 20 30 40 50
array =
0 0 0 1 2 3
0 0 1 2 4 5
2 3 4 5 6 7
1 2 3 4 5 6
5 6 8 7 5 4
I need the code to work so that it returns the x axis value and y axis value that don't contain any 0 values, it should be something like this:
x =
18 20 25
y =
30 40 50
Any leads for me to achieve this goal? help!
0 个评论
采纳的回答
Andrei Bobrov
2016-6-17
x =[ 11 15 16 18 20 25]
y =[10 20 30 40 50]
a =[0 0 0 1 2 3
0 0 1 2 4 5
2 3 4 5 6 7
1 2 3 4 5 6
5 6 8 7 5 4 ]
xout = x(all(a))
yout = y(all(a,2))
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!