working with an array
2 次查看(过去 30 天)
显示 更早的评论
I have a program that cuts out points from a two-dimensional vector that are at a distance 'd' from each other. The program starts working from the first element of the second column of the array. I want to add the value 'x0' to the value of this element and that the program starts with this value.
I have attached the vector to the message.
Thank you in advance.
This is my code:
format longG
d = 0.4053/sqrt(3); %0.4053
ii = 2;
a_0 = 0;
%a_0 = optimvar('a_0',43521); %!!!!!!!!!!!!!!!
general_t_d(:,1) = gn_nach(:,1);
general_t_d(:,2) = gn_nach(:,2);
general_t_d(:,2) = general_t_d(:,2) + a_0; % addition a_0
while ii < size(general_t_d,1)
if abs(general_t_d(ii+1,2) - general_t_d(ii,2)) < d
general_t_d(ii+1,:) = [];
else
ii = ii + 1;
end
end
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!