필터 지우기
필터 지우기

working with an array

조회 수: 4 (최근 30일)
Dmitry
Dmitry 2023년 5월 2일
편집: Dmitry 2023년 5월 5일
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);
Unrecognized function or variable 'gn_nach'.
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
  댓글 수: 3
Dmitry
Dmitry 2023년 5월 3일
I will try to explain with an example:
we start from B1, if mod(B1 - B2) < 0.22 we delete A2B2 and continue to compare B1 with B(i), if B1 - B(i) >= 0.22 we leave this element (A(i)B(i)) fixed on it and similarly move down the table.
I attached the table to the comment.
this is how my code works now. I want this 'cutting' to work not from the beginning B(1) but from an element whose value is B(1)+0.00015, and all previous elements A(i)B(i) to be deleted. And that's all. Thank you in advance!
Dmitry
Dmitry 2023년 5월 5일
편집: Dmitry 2023년 5월 5일

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by