Displaying one message after another!

1 view (last 30 days)
Lucky Innis
Lucky Innis on 9 Feb 2015
Answered: Image Analyst on 9 Feb 2015
I have two variables that I solved for.
When each of them display is shows:
Rescue on Monday ---- from one switch/case
at the bridge. ------ from another switch/case
but I want it to say:
Rescue on Monday at the bridge.
How do I get the messages from the two different variables, so show in a sentence rather than two?
thanks

Answers (1)

Image Analyst
Image Analyst on 9 Feb 2015
Try this: have the first switch assign to string1, and the second switch assign to string2. Then combine them:
bothStrings = sprintf('%s %s', string1, string2);
then you can display them using whatever method you like, for example fprintf(), set(), disp(), etc.

Categories

Find more on Characters and Strings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!