Selecting and exporting rows from matrix
显示 更早的评论
Hello,
I have a number of coordinates around the origin (1st and 2nd quadrant) in a big matrix that I need to filter appropriately. Here's an example:
x = [2 3 2 5 1 3 4 -3 -4 -3 -6 2 4 1 3 2]'; %some x
y = [1 3 4 1 2 4 2 0.4 0.6 1 1 3 1 2 4 5]'; %some y
Coords = [x,y];
Coords(:,3) = atan2d(y,x); %angle with origin
for i = 1: 16
if Coords(i,3) > 150 %treshold
Coords(i,4) = 1;
end
end
So I have identified all coordinate pairs that are in a certain area in quadrant 2 (numbered '1'). Now what I want to do is go through the matrix and divide that in three smaller matrices/ 'chunks', i.e. a first matrix of 7x4 (all indicated by 0), a second 4x4 (indicated by 1s) and a third 4x5 (0s again). Any idea how to do this in a loop so that variable 'chunk' lengths are possible to incorporate? I guess I need something in the loop that uses the switch from 0 to 1 and back and uses that to export?
Many thanks in advance!
-J-
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!