Breaking up strings in Matlab - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Breaking up strings in Matlab

johnjoe2010johnjoe2010 Posts: 1Member
Hello! I would like to know if there is a way to break up a long (very long--several sentences) string into several lines? In my program, I need to use an input command which contains a question for the user. But I need to make it look presentable and I don't want the user to have to scroll the page. Is there a way to do that? I know that the '...' command doesn't work for strings.
Thank you very much!!


  • jjasso5jjasso5 Posts: 41Member
    Try this approach:

    s1 = 'string 1 ';
    s2 = 'string 2';
    s3 = 'string 3';
    s4 = [s1 s2 s3 ' '];

    i1 = input(s1, 's');
    i2 = input(s4, 's');
Sign In or Register to comment.