Display iteration value amongst other preset text.

조회 수: 1 (최근 30일)
Jay
Jay 2016년 10월 20일
답변: Adam 2016년 10월 20일
I have a section of code that I want to use that should specify the iteration number amongst it whilst running an if statement.
So, for the following code, I would like the statement to read 'Difference In X Coordinate Value', i , 'Between Left and Right Model Space' where i will = 2.
delta_Mod(count_BM,3) = zeros
delta_Mod(2,1) = 3
for i =1:count_BM delta_Mod(i,1) = (X_m_Li(i,1) - X_m_Ri(i,1)) delta_Mod(i,2) = (Y_m_Li(i,1) - Y_m_Ri(i,1)) delta_Mod(i,3) = (Z_m_Li(i,1) - Z_m_Ri(i,1))
if delta_Mod(i,1) ~= 0
disp( 'Difference In X Coordinate Value', i , 'Between Left and Right Model Space')
elseif delta_MOd(i,3) ~= 0
disp( 'Difference In Z Coordinate Value', i , 'Between Left and Right Model Space')
else
end
Thanks in advance.

채택된 답변

Adam
Adam 2016년 10월 20일
sprintf( 'Difference In X Coordinate Value %d Between Left and Right Model Space', i )
would do the job instead of disp

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Language Fundamentals에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by