필터 지우기
필터 지우기

how to display/table numbers and letters

조회 수: 2 (최근 30일)
grant w
grant w 2022년 3월 30일
편집: Dave B 2022년 3월 30일
im trying display GZ but any way i have tried to display it, just doesnt work.any suggetion on how to do it?
Z=6;
z=[1;2;3;4;5;6]
for j=1:1:Z
if (z(j,1)<4)
GZ=log(10/(4-z(j,1)))
elseif (z(j,1)==4)
GZ=Inf
else GZ=NaN
end
end

답변 (1개)

Dave B
Dave B 2022년 3월 30일
편집: Dave B 2022년 3월 30일
I think this is what you're trying to produce?
z=[1;2;3;4;5;6];
Gz = nan(size(z));
Gz(z<4) = log(10./(4-z(z<4)));
Gz(z==4) = inf;
Gz
Gz = 6×1
1.2040 1.6094 2.3026 Inf NaN NaN

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by