How can I display a variable in a text string inside a message box?

19 vues (au cours des 30 derniers jours)
Zac
Zac le 28 Août 2013
Hi all,
I'm trying to get my code to output a line of text inside a message box, and have it state the value of a variable that it has calculated. The basic idea I want is:
if abs(freq-BPFI)<1.5
msgbox('Event Frequency=<freq> Inner Race Fault Detected','Fault Detected','warn')
end
Where freq is the value of the variable. Could anybody tell me how I can do this? Thanks in advance.
Zac

Réponse acceptée

Walter Roberson
Walter Roberson le 28 Août 2013
msgbox(sprintf('Event Frequency=%g Inner Race Fault Detected', freq), 'Fault Detected', 'warn')

Plus de réponses (0)

Catégories

En savoir plus sur Language Support 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