I can Not include my condition
1 view (last 30 days)
my code produce some elements with x,y,z coordinates.
I want to put a condition that make them to have z limit, for example from z 0-100 there are some elements and also from z 100-200 there are some elements and so on but there is no element that is in both z limit area.
any suggestion will may be helpful and Thank you for that.
for i = 1:ne
for j = 1 : nen
Mohammad Abouali on 9 Dec 2014
Edited: Mohammad Abouali on 9 Dec 2014
Ok, now I get it (I think).
You have four points, and lines connected between each two points are elements. (so in case of four points you have 6 elements or 6 lines).
Now You want only those lines (elements) that the ending points have z<500 or 500<z<1000 and not both. Pretty much you want your line to stay either under 500 elevation or in 500..1000 elevation and not cross the 500.
So, the solution depends a bit on how you store the elements. Let's say you have 4 points so point 1 to 4. Something like this should work:
clear; clc; close all;
P=[ 0 0 0;
500 500 500;
500 500 1000;
500 500 1500 ];
elements=[1 2; % defining start and end point
% this is your test function (I used <= instead of <)
testFunc=@(x) ( all(P(x,3)<=500) || ...
all(P(x,3)>=500 & P(x,3)<=1000) );
% this parts checks the condition.
disp('Elements satisfying the condition:')
disp('Elements end points:')