MATLAB How to Add Spaces in MatLab Output for Workshop 5, Exercise 3?

  • Thread starter Thread starter Spectre32
  • Start date Start date
  • Tags Tags
    Matlab
AI Thread Summary
The discussion revolves around adding spaces between lines in output using MATLAB code. The original poster seeks to format their output to include additional spacing between lines for better readability. They provide an example of their current output and express confusion about how to achieve the desired format. A helpful response suggests using a loop with multiple `disp(' ')` statements to create the necessary spacing. The original poster confirms that this solution works, successfully achieving the desired output format with the added spaces.
Spectre32
Messages
136
Reaction score
0
I gott add spaces into this output, how in sweet gods name do i do this? Here is my code:

disp( '' )
disp( 'Solution to workshop 5, exercise 3 ')
disp( 'Calculate the volume of a piece of iron by determining the amount of')
disp( 'water displaced as it is submerged.')



Thanks
 
Physics news on Phys.org
I'm confused what you're asking for...

what do you want the output to look like?
 
Well when it's displayed.. it looks like this:

Solution to workshop 5, exercise 3
Calculate the volume of a piece of iron by determining the amount of
water displaced as it is submerged.

I want it to look like this:

Solution to workshop 5, exercise 3

Calculate the volume of a piece of iron by determining the amount of

water displaced as it is submerged.

---with space(s) inbetween the lines. I can't figure out how to do this
 
Try this:

Code:
for a=1
   disp('a')
   disp(' ')
   disp(' ')
   disp('b')
end

It should output
Code:
a


b
 
AH! Score. Thanks man, it's workin now!
 

Similar threads

Replies
3
Views
2K
Replies
2
Views
2K
Replies
12
Views
4K
Replies
6
Views
19K
Replies
8
Views
2K
Replies
27
Views
8K
Replies
5
Views
7K
Back
Top