I can Not include my condition
1 view (last 30 days)
Show older comments
Hamid on 9 Dec 2014
Commented: Hamid on 10 Dec 2014
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
dpb on 9 Dec 2014
Edited: dpb on 9 Dec 2014
Need more precise illustration of the dataset as it's stored and what it is you're actually asking for. Give a small sample that illustrates both the full input and the desired output.
We know you understand what your explanation means but we don't have the insider's knowledge to be able to read between the lines beyond what is actually provided here.
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:')
More Answers (0)
Find more on Programming Utilities in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!