Filter löschen
Filter löschen

Display iteration value amongst other preset text.

2 Ansichten (letzte 30 Tage)
Jay
Jay am 20 Okt. 2016
Beantwortet: Adam am 20 Okt. 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.

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Language Fundamentals finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by