Hi everybody,
I want to put a condition in my code, This is the code:
for i = 1:ne
nodnum=zeros(1,nen);
for j = 1 : nen
check=Dof(:,1:nend)-ones(n,1)*Edof(i,(j-1)*nend+2:j*nend+1);
[indx,dum]=find(check==0);
nodnum(j)=indx(1);
end
Ex(i,:)=Coord(nodnum,1)';
if nsd>1
Ey(i,:)=Coord(nodnum,2)';
end
if nsd>2
Ez(i,:)=Coord(nodnum,3)';
end
Le(i)=sqrt((Ex(i,1)-Ex(i,2))^2+(Ey(i,1)-Ey(i,2))^2+(Ez(i,1)-Ez(i,2))^2);
and this is that I want to put as a condition,
(Le(i)/Ep(i,6))>200
please help me out

댓글 수: 2

Zoltán Csáti
Zoltán Csáti 2014년 12월 8일
Why don't you just put that condition to the specific place with an if structure?
Hamid
Hamid 2014년 12월 8일
편집: Hamid 2014년 12월 8일
Thank you Zoltán Csáti
I don't know how to do this because I want Ex,Ey,Ez obtain base on
(Le(i)/Ep(i,6))>200

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

 채택된 답변

Thorsten
Thorsten 2014년 12월 8일

0 개 추천

if Le(i)/Ep(i,6) > 200
% do something
end

댓글 수: 6

Hamid
Hamid 2014년 12월 8일
편집: Hamid 2014년 12월 8일
Thank you Thorsten
I want Ex,Ey,Ez obtain base on
(Le(i)/Ep(i,6))>200
Thorsten
Thorsten 2014년 12월 8일
편집: Thorsten 2014년 12월 8일
Ok. But Le depends on Ex, Ey, Ez, so you have to compute Ex, Ey, Ez first. Then you can set the values to NaN (not a number):
if Le(i)/Ep(i,6) > 200
Ex(i,:)= nan(1, nen);
Ey(i,:)= nan(1, nen);
Ez(i,:)= nan(1, nen);
end
Dear Thorsten
I get this error, What should I do?
??? Undefined function or method 'nans' for input arguments of type 'double'.
Error in ==> coordxtr at 54
Ex(i,:)= nans(1, nen);
Thank you very very much.
Sorry, should be
nan
I have corrected it above.
Hamid
Hamid 2014년 12월 8일
Dear Thorsten
Ex,Ey,Ez are coordinates for elements, They must be numbers otherwise it has no meaning.
Thanks.
Hamid
Hamid 2014년 12월 8일
PLEASE HELP ME Thorsten

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Timing and presenting 2D and 3D stimuli에 대해 자세히 알아보기

태그

질문:

2014년 12월 8일

댓글:

2014년 12월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by