How to store an x-y coordinate under one Variable

42 vues (au cours des 30 derniers jours)
Giselle Tiede
Giselle Tiede le 11 Nov 2019
Hi!
I want to be able to store the x and y coordinates under one variable name, which then I would like to be able to say plot(variable), and it display the x-y coordinate.
For example, if
x=455
y=340
B=x & y
I would like B to equal (x,y).
Then when I plot(B), it would plot the x and y coordinate.
Is there a consice way to plot this?
The solution I currently have is:
x=455
y=340
figure; plot(x, y)
However, this is not ideal as I have a lot of data points and would like to call them up quickly. Is there a way to store them in a variable and then call them up?

Réponse acceptée

David Hill
David Hill le 11 Nov 2019
I really don't understand. How are your data points stored? Why is it easier with a single vector rather than two? You can always make your own function.
function Plot(B)
plot(B(1),B(2));
end
where B=[x,y].

Plus de réponses (1)

Giselle Tiede
Giselle Tiede le 11 Nov 2019
Capture.PNG
This is how they are stored right now

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by