determine elements belonging to the same group and change coordinates

2 ビュー (過去 30 日間)
Ana Bermejo Jimenez
Ana Bermejo Jimenez 2019 年 8 月 28 日
Capture.JPG
clc
clear all
M = dlmread('C:\Users\wexample_case2.txt','\t',1);%%change path
element = M(:,1);
xs = M(:,2);
xe = M(:,3);
ys = M(:,4);
ye = M(:,5);
zs = M(:,6);
ze = M(:,7);
%%
for i=1:length(element-1)
if xe(i)==xs(i+1) && ye(i)==ys(i+1)
xs(i+1)=xs(i);
ys(i+1)=ys(i);
xe(i)=xs(i);
ye(i)=ys(i);
xs1=xs;
elseif xs(i)==xe(i-1) && ys(i)==ye(i-1)
xe(i)=xs(i-1)
ye(i)=ys(i-1)
else
xe(i)=xs(i)
end
end

採用された回答

darova
darova 2019 年 8 月 28 日
Just loop through elements
clc,clear
A = load('wexample_case2.txt');
x = A(:,2:3);
y = A(:,4:5);
z = A(:,6:7);
for i = 1:3:size(x,1)
j = (0:2) + i;
x(j,:) = x(i,1);
y(j,:) = y(i,1);
end
plot3(x',y',z','.-r')
xlim([0 7])
ylim([0 6])
  10 件のコメント
darova
darova 2019 年 8 月 29 日
Current script for piles that are always straight
Ana Bermejo Jimenez
Ana Bermejo Jimenez 2019 年 8 月 30 日
it works fine thank you!

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by