Info

This question is closed. Reopen it to edit or answer.

How can I fix plot problems when allocating memory outside of a loop?

8 views (last 30 days)
I'm using serial port to collect data. Inside of the loop, I have a vector to store the data points and then plot in a graph, but I need to allocate memory outside of the loop. When I do it, all the data points start from the origin (like the picture below). I'm allocating memory this way:
v2 = zeros(100,1);
v1 = zeros(100,1);
t = zeros(100,1);
How can I fix it?
Thank you.
  1 Comment
Walter Roberson
Walter Roberson on 31 Aug 2015
Please show the code for storing in the arrays, including the initialization of any index variables.

Answers (0)

Community Treasure Hunt

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

Start Hunting!