MATLAB Plotting Multiple Pictures with Points from a Matrix in MATLAB

AI Thread Summary
A novice MATLAB programmer seeks assistance with plotting points from a text file containing 56 points for 40 images. After loading the data into a matrix, the user successfully plots each image's points in a loop. They inquire about overlapping multiple plots in the same figure, suggesting the use of the "hold on" command. However, they encounter an error regarding an undefined input argument when trying to create a function for plotting a specified number of plots. Suggestions include using the "axes" function to manually set positions and exploring the "subaxis" tool for better control over overlapping plots. The discussion emphasizes the importance of ensuring all input arguments are defined and suggests plotting all points at once for simplicity.
maxmilian
Messages
12
Reaction score
0
Hi all

I am novice MATLAB programmer, and I need alittle help with plotting points, given in a txt. file.

I have a text file containing 56 points for 40 pictures. I've loaded the txt file by "load -ASCII nameofthefile.TXT" - and thereby created a matrix <112x40 double> the first 56 rows are x and rows from 57 to 112 are the y. My question is how do I plot each of these 40 pictures each containing the 56 points ?

kind regards

Maxmilian
 
Physics news on Phys.org
for i=1:40
plot(A(1:56,i),A(57:112,i))
pause(.1)
end
 
Thanks for your nice reply - what would I need to do if I wanted to have multiple plots in the same figure ?
 
doc subplot

OR (better)

Download subaxis from the file exchange and play with it and read the help file and documentation
 
subplot is unfortunately not what I need. I need the plots to overlap each other
 
You'll have to call the axes by handle then:

ax.(sprintf('%i',i)) = axes;

Thn you can set their position manually:

set(ax(sprintf('%i',i),'Position',rect);

Where rect is a four element vector of the four corners. Try googlIng "axes properties"
 
I resolved it by using "hold on"
But I am getting a error with my function when I am trying this ;

function figureplot(m)
load -ascii shapes.txt

for i=1:m
...

? Input argument "m" is undefined.

What I am trying to do, is making a function where I can tell it how many plots I want in a single figure. So by calling figureplot(5) - it would plot 5 plots in a figure.
 
Oh! you wanted them to overlap all in the same place...? Why don't you just plot them all at once?

I don't see a problem with what you've posted. I usually don't use the -ascii flag and haven't had problems, but maybe it's something you do elsewhere in your code?
 
Back
Top