How can I display a variable in a text string inside a message box?
5 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
Walter Roberson
2013-8-28
msgbox(sprintf('Event Frequency=%g Inner Race Fault Detected', freq), 'Fault Detected', 'warn')
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Language Support 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!