How to get 3 variables in the title?

Chris · May 7, 2024 · 1.9K views
Question
I'm trying to get the title to say 'Rocket(value), Chute1(value), Chute2(value)', where the values correspond to each one. Rocket, Chute1, and Chute2 are all inputs in my function.   This is what i've tried, but it wont work. I've seen Dougs tutorial on this, though this does not help me.   title('Rocket('(rocket) '),' 'Chute1('chute1 '),' 'Chute2('chute2 '))  
Expert Answer
Profile picture of Kshitij Singh
Kshitij Singh PhD Expert
Answered Aug 20, 2026

Use sprintf() to create a caption:

 

caption = sprintf('Rocket(%.3f), Chute1(%.3f), Chute2(%.3f)',...
    Rocket, Chute1, Chute2);
title(caption, 'FontSize', 16);

You can use %d instead of %.3f if the values are integers rather than floating point. You can put a \n anywhere that you want to go to a new line.

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!