Display iteration value amongst other preset text.

1 vue (au cours des 30 derniers jours)
Jay
Jay le 20 Oct 2016
Réponse apportée : Adam le 20 Oct 2016
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.

Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur Language Fundamentals dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by