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

  • Context: MATLAB 
  • Thread starter Thread starter Spectre32
  • Start date Start date
  • Tags Tags
    Matlab
Click For Summary

Discussion Overview

The discussion revolves around formatting output in MATLAB, specifically how to add spaces between lines in the console output. Participants are focused on a practical application related to a workshop exercise.

Discussion Character

  • Homework-related

Main Points Raised

  • One participant expresses a need to add spaces in the output of their MATLAB code for clarity.
  • Another participant seeks clarification on the desired output format.
  • A participant provides a code snippet that demonstrates how to insert blank lines between outputs.
  • A later reply confirms that the suggested solution works for the original poster.

Areas of Agreement / Disagreement

The discussion appears to be resolved with the original poster finding a solution that meets their needs, indicating agreement on the effectiveness of the proposed method.

Contextual Notes

Limitations: The discussion does not address potential variations in output formatting or other methods that could achieve similar results.

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 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 6 ·
Replies
6
Views
19K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 27 ·
Replies
27
Views
8K
  • · Replies 5 ·
Replies
5
Views
7K
Replies
4
Views
4K
Replies
5
Views
9K