MATLAB plot on an axe on a different figure

In summary, the person is having trouble plotting data from a for loop in one file to a figure in another file due to MATLAB not supporting multi-threading. They are looking for help on how to use handles to plot in the desired figure.
  • #1
Gean
5
0
Hi,

I have this problem:
I have a main file (main.m) in which is coded a for loop (needed for some data-gathering). De data is stored in a vector.
This vector is passes to a 2nd figure (test1.m) which has an axe. Here I want to plot the data in a "real-time" mode. I do this with another for-loop.
Because MATLAB apparently doens't support Multi-threading, I want to edit main.m on this way:
Inside the for-loop I want to say something like: plot in the axe in test1.m.

I understand that this must be done with handles, but I can't figure out how to do this.


Any help?
 
Physics news on Phys.org
  • #3
Thanks!
 

1. How do I plot a graph on a different figure in MATLAB?

To plot a graph on a different figure in MATLAB, you can use the figure command followed by the plot command. For example, figure(2) will create a new figure window and plot(x,y) will plot the data on that figure.

2. Can I plot multiple axes on the same figure in MATLAB?

Yes, you can plot multiple axes on the same figure in MATLAB using the subplot command. This allows you to divide the figure into smaller axes and plot different data on each one.

3. How do I change the color of the axes in a MATLAB plot?

You can change the color of the axes in a MATLAB plot by using the axes command followed by the Color property. For example, axes('Color','red') will change the color of the axes to red.

4. Is it possible to label the axes in a MATLAB plot?

Yes, you can label the axes in a MATLAB plot by using the xlabel and ylabel commands. These commands allow you to add a label to the x-axis and y-axis, respectively.

5. How can I save a MATLAB plot as an image on my computer?

To save a MATLAB plot as an image on your computer, you can use the saveas command. This command allows you to specify the file format and name of the image you want to save. For example, saveas(gcf,'myplot.png') will save the plot in the PNG format with the file name "myplot" on your current working directory.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
32
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
Back
Top