Display iteration value amongst other preset text.

1 visualizzazione (ultimi 30 giorni)
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.

Risposta accettata

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

Più risposte (0)

Categorie

Scopri di più su Language Fundamentals in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by