Display iteration value amongst other preset text.

2 次查看(过去 30 天)
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