How to plot a center of pressure plot, where the plot is constantly being updated and the new point connects to the previous point.

17 Ansichten (letzte 30 Tage)
I have my x and y values stored in a .mat file. Is there a way to display them where the new point in connected to the previous point as shown in the example image below.

Antworten (1)

Image Analyst
Image Analyst am 26 Mai 2022
s = load(fileName)
x = s.x;
y = s.y;
plot(x, y, 'b-', 'LineWidth', 2);
grid on;
xlabel('x');
ylabel('y');
  2 Kommentare
Jonas Bender
Jonas Bender am 4 Jul. 2023
Dear Image Analyst,
this works well. However, why is this dot indexing for x and y?
Thanks, Jonas
Image Analyst
Image Analyst am 5 Jul. 2023
The way we usually recommend getting variables from a MAT file is to load all of them into a single structure variable, which can avoid cluttering up a workspace with lots more variables that might not be needed. Then to get a variable, which is a field of the structure you can use the normal OOP dot referencing method. From the help:
S = load(___) loads data into S, using any of the input argument combinations in previous syntaxes. If filename is a MAT-file, then S is a structure array; if filename is an ASCII file, then S is an m-by-n double-precision array containing data from the file, where m is the number of lines in the file and n is the number of values on each line.

Melden Sie sich an, um zu kommentieren.

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by