Simple Matlab Graphics Question

In summary, the person is trying to figure out how to save 60 graphs generated by a for loop to a file and rename them. They came across a helpful thread on a forum but it doesn't fully answer their question. They are looking for a way to maximize the screen and iteratively name the figures. The advice given is to set the default figure position before plotting anything.
  • #1
Raging Dragon
6
0
I have a for loop spitting out 60 graphs that I have to save to a file. I have to rename them anyways, so saving them by hand is not the issue. I'm wanting know how to maximize the screen and iteratively name the figures.

i.e. my code looks like

for i = 1:30

(stuff)

figure(i)
do more stuff

figure(100*i)
do other stuff

end

I came across this old thread https://www.physicsforums.com/showthread.php?t=187887 which was helpful, but doesn't fully answer what I want to do because:

figure(1,'Position',[0 0 1680 1050])

or

figure(1,[0 0 1680 1050])

obviously returns the error
? Error using ==> figure
Too many input arguments.
 
Physics news on Phys.org
  • #2
If you do something like

fullscreen = get(0,'ScreenSize');
set(0, 'DefaultFigurePosition', [0 -50 fullscreen(3) fullscreen(4)])

before plotting anything then it will set the default size for new figures to be maximised.

Hope that helps :-)
 
  • #3
http://www.mathworks.com/matlabcentral/newsreader/view_thread/285121
 

1. How do I plot a basic graph in Matlab?

To plot a basic graph in Matlab, you can use the plot function. First, create two arrays for the x and y values of your data. Then, use the plot function and pass in the x and y arrays as arguments. Finally, use the xlabel and ylabel functions to label your axes.

2. Can I customize the appearance of my graph in Matlab?

Yes, you can customize the appearance of your graph in Matlab. You can change the line color, style, and thickness using the color, linestyle, and linewidth arguments in the plot function. You can also add a title to your graph using the title function.

3. How do I add multiple lines to a single graph in Matlab?

To add multiple lines to a single graph in Matlab, you can use the hold function. After plotting the first line, use the hold on command. Then, plot the second line using the same plot function. Finally, use the legend function to label each line.

4. Can I save my graph as an image file in Matlab?

Yes, you can save your graph as an image file in Matlab. After plotting your graph, use the saveas function and specify the file format (e.g. .png, .jpg). You can also use the print function to save your graph as a high-resolution image.

5. Is it possible to create 3D graphs in Matlab?

Yes, it is possible to create 3D graphs in Matlab. You can use the plot3 function to plot a 3D line graph, and the surf function to plot a 3D surface graph. You can also customize the appearance of these graphs using various arguments such as color, linestyle, and meshgrid.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
566
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
Back
Top