How do I print a string and an array on the same line or with one function call?
Show older comments
Currently, I have to write two lines of code as shown below to display a string followed by the values in my array. I do this by calling "disp" twice:
>> disp('Your array is')
Your array is
>> disp([1 2; 3 4])
1 2
3 4
I am looking for a faster and easier way to display a string and then an array.
It would be great if there was a MATLAB function that could do this. Having a MATLAB function to do this in one line would improve the simplicity of my code while saving me a lot of time and effort.
Accepted Answer
More Answers (0)
Categories
Find more on Dates and Time 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!